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 | |
class Foo | |
{ | |
private $private; | |
public function __construct($value) | |
{ | |
$this->private = $value; | |
} | |
public function getOther(Foo $object) | |
{ |
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 | |
// client code | |
$customer = $customerRepository->find($id); | |
$orders = $customer->getOrders(); |
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
#! /bin/sh | |
alias gs="git status" | |
alias gc="git commit" | |
alias gr="git checkout" | |
alias ga="git add" | |
alias gl="git lola" |
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 | |
protected function assertStringDistanceInPercent($minimumPercentage, $expected, $actual) | |
{ | |
$percentage = 0; | |
similar_text($expected, $actual, $percentage); | |
$this->assertGreaterThanOrEqual( | |
$minimumPercentage, | |
$percentage, | |
"The distance between the strings should be greater than or equal to $minimumPercentage%, got $percentage%"); |
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
; example deps.ini file | |
[twig] | |
git=http://github.com/fabpot/Twig.git | |
target=vendor/twig | |
version=v1.7.0 |
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
-- Given a list of phone numbers, determine if it is consistent. | |
-- In a consistent phone list no number is a prefix of another. For example: | |
-- Bob 91 12 54 26 | |
-- Alice 97 625 992 | |
-- Emergency 911 | |
-- In this case, it is not possible to call Bob because the phone exchange | |
-- would direct your call to the emergency line as soon as you dialled the | |
-- first three digits of Bob's phone number. So this list would not be consistent. | |
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
<!doctype html> | |
<html ng-app> | |
<script src="http://code.angularjs.org/angular-1.0.0rc3.min.js"></script> | |
<script src="https://raw.github.com/madrobby/keymaster/master/keymaster.min.js"></script> | |
<script> | |
function HelloCntl($scope, $location) { | |
$scope.name = 'World'; | |
$location.path('/foo'); | |
key('x', function() { | |
console.log('x key pressed'); |
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
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \[\1\]/' | |
} | |
if [[ ${EUID} == 0 ]] ; then | |
PS1='\[\033[01;31m\]\u@\h \[\033[01;34m\]\w\[\033[01;35m\]$(parse_git_branch)\[\033[01;34m\] \$ \[\033[00m\]' | |
else | |
PS1='\[\033[01;31m\]\u@\h \[\033[01;00m\]\w\[\033[00;33m\]$(parse_git_branch)\[\033[00m\] \$ ' |
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
git log --pretty=oneline --no-merges COMMIT..COMMIT |
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 getClass = function() { | |
var funcNameRegex = /function (.{1,})\(/; | |
var results = (funcNameRegex).exec((this).constructor.toString()); | |
return (results && results.length > 1) ? results[1] : ""; | |
}; | |
// define a class | |
function Animal() {} | |
// do this for all classes that need the getClass() method |