This gist is about:
- https://twitter.com/taylorotwell/status/600680897550098432
- https://twitter.com/Ocramius/status/600705252539691008
Mainly:
functioncannot (should not) be used when side-effects occur
This gist is about:
Mainly:
function cannot (should not) be used when side-effects occur| <?php | |
| /** | |
| * @author: gareth | |
| */ | |
| class Lock | |
| { | |
| /** | |
| * @var string | |
| */ |
| angular.module('app', []).directive('ngDebounce', function($timeout) { | |
| return { | |
| restrict: 'A', | |
| require: 'ngModel', | |
| priority: 99, | |
| link: function(scope, elm, attr, ngModelCtrl) { | |
| if (attr.type === 'radio' || attr.type === 'checkbox') return; | |
| elm.unbind('input'); | |
| #!/bin/bash | |
| # | |
| # Bash script to setup headless Selenium (uses Xvfb and Chrome) | |
| # (Tested on Ubuntu 12.04) | |
| # Add Google Chrome's repo to sources.list | |
| echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list | |
| # Install Google's public key used for signing packages (e.g. Chrome) | |
| # (Source: http://www.google.com/linuxrepositories/) |
| <?php | |
| define('T', ' '); | |
| define('N', PHP_EOL); | |
| $functions = array(); | |
| $classes = array(); | |
| $constant_prefix = 'X_'; | |
| $php = '<?php' . N; |
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
| input { | |
| gelf { type => 'gelf' } | |
| } | |
| output { | |
| mongodb { | |
| host => '127.0.0.1' | |
| database => 'rails_logs' | |
| collection => "%{facility}" | |
| } | |
| } |
| <?php | |
| /** | |
| * Phing task to generate a Zend Framework style autoloader classmap file | |
| * | |
| * This task requires ZF 2.x to be in your include_path. You can run phing like | |
| * so to enforce this: | |
| * | |
| * $ export PHP_COMMAND="php -d include_path=.:<path to zf library>:<path to pear>" | |
| * $ phing ... |
| #!/usr/bin/env ruby | |
| # List all keys stored in memcache. | |
| # Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place. | |
| require 'net/telnet' | |
| headings = %w(id expires bytes cache_key) | |
| rows = [] |