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 Db | |
{ | |
private $pdo; | |
protected $table; | |
public function __construct() | |
{ | |
$parameters = json_decode(file_get_contents('config.json')); |
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/bash | |
JSLINT="jslint --indent 4 --white true" | |
for file in $(git status | grep -P '\.((js)|(html)|(json))$'); do | |
if node $JSLINT $file 2>&1 | grep 'No errors found' ; then | |
echo "jslint passed ${file}" | |
exit 0 | |
else | |
node $JSLINT $file |
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 | |
namespace Model; | |
use PHPFluent\JSONSerializer\Serializer; | |
class Cliente extends Serializer | |
{ | |
/** | |
* @PHPFluent\JSONSerializer\Attribute | |
*/ |
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 | |
//src/WsChatter/Chat.php | |
namespace WsChatter; | |
use Ratchet\MessageComponentInterface; | |
use Ratchet\ConnectionInterface; | |
class Chat implements MessageComponentInterface { | |
protected $clients; | |
public function __construct() { |
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 | |
echo "\n--------------------------------------------------------------------------------------------------\n"; | |
echo "| Git cherry-pick tool |"; | |
echo "\n--------------------------------------------------------------------------------------------------\n"; | |
if (empty($argv[1]) || empty($argv[2])) { | |
die("Usage: php pick.php [/git/repo/path] [hash]\n"); | |
} |
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
class ConcreteKlass | |
def self.new() | |
return [] | |
end | |
end | |
obj = ConcreteKlass.new | |
print obj.inspect #WHY? WHYYY? Hey, let's instantiate new ConcreteKlass, now, it's an array? WTF! |
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
'use strict'; | |
import { createClass } from 'react/addons'; | |
let App = createClass({ | |
render: function() { | |
return <div> | |
<Button label="Open!" target="modalTest" classNames=".buttonStyle" /> | |
<Modal name="modalTest"> | |
<div class='modal'> |
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
function hex_sha1(e){return binb2hex(core_sha1(str2binb(e),e.length*chrsz))}function b64_sha1(e){return binb2b64(core_sha1(str2binb(e),e.length*chrsz))}function str_sha1(e){return binb2str(core_sha1(str2binb(e),e.length*chrsz))}function hex_hmac_sha1(e,t){return binb2hex(core_hmac_sha1(e,t))}function b64_hmac_sha1(e,t){return binb2b64(core_hmac_sha1(e,t))}function str_hmac_sha1(e,t){return binb2str(core_hmac_sha1(e,t))}function sha1_vm_test(){return"a9993e364706816aba3e25717850c26c9cd0d89d"==hex_sha1("abc")}function core_sha1(e,t){e[t>>5]|=128<<24-t%32,e[(t+64>>9<<4)+15]=t;for(var r=Array(80),n=1732584193,a=-271733879,o=-1732584194,u=271733878,h=-1009589776,c=0;c<e.length;c+=16){for(var s=n,i=a,f=o,l=u,d=h,A=0;80>A;A++){16>A?r[A]=e[c+A]:r[A]=rol(r[A-3]^r[A-8]^r[A-14]^r[A-16],1);var m=safe_add(safe_add(rol(n,5),sha1_ft(A,a,o,u)),safe_add(safe_add(h,r[A]),sha1_kt(A)));h=u,u=o,o=rol(a,30),a=n,n=m}n=safe_add(n,s),a=safe_add(a,i),o=safe_add(o,f),u=safe_add(u,l),h=safe_add(h,d)}return Array(n,a,o,u,h)}function sha1 |
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 | |
function readStdin($message = null) | |
{ | |
if ($message) { | |
echo $message.PHP_EOL; | |
} | |
$fr=fopen("php://stdin","r"); | |
$input = fgets($fr,128); | |
$input = rtrim($input); |
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 | |
abstract class Enum extends \ArrayObject | |
{ | |
public final function __construct() | |
{ | |
$constantsToRemove = ['STD_PROP_LIST', 'ARRAY_AS_PROPS']; | |
$constants = (new \ReflectionObject($this))->getConstants(); | |
foreach ($constants as $constant => $value) { |
OlderNewer