This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Make all protected methods public for PHPUnit | |
*/ | |
class ExampleClassTest extends ExampleClassTest { | |
public function __call($method, $args) { | |
$method = new \ReflectionMethod('ExampleClass', $method); | |
$method->setAccessible(true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler' | |
Bundler.require :default | |
logger = Logger.new(STDOUT) | |
# comma-separated list of user IDs to follow | |
user_ids = '1000,2000,3000' | |
search = { | |
:consumer_key => '', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Array.findRanges | |
Turns this: | |
["a","a","a","b","b","c","c","c","c","c","a","a","c"] | |
into this: | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request'); | |
var crypto = require('crypto'); | |
var hash = crypto.createHash('sha256'); | |
hash.setEncoding('hex'); | |
var fp = request.get('http://www.google.com/favicon.ico').on('end', function(){ | |
hash.end(); | |
console.log("Request finished. Hash: " + hash.read()); | |
}).pipe(hash); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// When I try to sign in, I get TokenMismatchException | |
namespace App\Http\Controllers\Auth; | |
use App\User; | |
use Validator; | |
use App\Http\Controllers\Controller; | |
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
links = [ | |
{:a => :z}, | |
{:b => :z}, | |
{:c => :z}, | |
{:d => :y}, | |
{:e => :x}, | |
{:e => :w}, | |
{:e => :v}, | |
{:f => :u}, | |
{:f => :t}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew install ruby-install | |
ruby-install ruby 2.1.6 | |
gem install bundler | |
brew install libxml2 libxslt # usually required for some ruby libraries | |
brew install chruby | |
# this sets the paths for ruby and bundle to the newly installed ruby | |
chruby 2.1.6 | |
# now you can install other rubies: | |
ruby-install ruby 2.2.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Converts base 10 to base 60. | |
* http://tantek.pbworks.com/NewBase60 | |
* @param int $n | |
* @return string | |
*/ | |
function b10to60($n) | |
{ | |
$s = ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GET http://atlas.dev/api/context?latitude=45.5118&longitude=-122.6433 | |
{ | |
"latitude":45.5118, | |
"longitude":-122.6433, | |
"locality":"Portland", | |
"region":"Oregon", | |
"country":"USA", | |
"best_name":"Portland", | |
"full_name":"Portland, Oregon, USA", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
trait Hello { | |
public function sayHello() { | |
echo 'Hello '; | |
} | |
} | |
trait World { | |
public function sayWorld() { | |
echo 'World'; |