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 benchmark($name, $iterations, Closure $function) | |
{ | |
echo "Starting Benchmark: {$name} (".number_format($iterations)." Iterations)\n"; | |
$start = microtime(true); | |
for ($i = 0; $i < $iterations; $i++) { | |
$function(); | |
} | |
$elapsed = microtime(true) - $start; |
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
--- | |
- name: Prepare New Digital Ocean Droplet | |
hosts: you.example.com | |
user: ansible | |
tasks: | |
- action: shell date +%s | sha256sum | base64 | head -c 6 | |
register: rand_var | |
- digital_ocean: > | |
state=present | |
command=droplet |
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 Core\Database; | |
use Logger; | |
use mysqli; | |
use Psr\Log\LoggerInterface; | |
/** | |
* Class MySQLiProxy |
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 () { | |
var root = $(document.getElementsByTagName('body')); | |
var watchers = []; | |
var f = function (element) { | |
if (element.data().hasOwnProperty('$scope')) { | |
angular.forEach(element.data().$scope.$$watchers, function (watcher) { | |
watchers.push(watcher); | |
}); | |
} |
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
--- | |
- name: Install libfontconfig1 | |
apt: pkg=libfontconfig1 state=installed | |
- name: Download phantomjs | |
get_url: url=https://bitbucket.org/ariya/phantomjs/downloads/{{phantomjs.name}}.tar.bz2 dest=/usr/local/share/{{phantomjs.name}}.tar.bz2 validate_certs=no | |
- name: Unpack phantomjs | |
command: tar xvjf /usr/local/share/{{phantomjs.name}}.tar.bz2 -C /usr/local/share creates=/usr/local/share/{{phantomjs.name}} |
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 | |
// test data | |
class Foo { | |
private $a; | |
private $b; | |
function __construct($a, $b) | |
{ |
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 | |
# Script for placing sudoers.d files with syntax-checking | |
# Making a temporary file to contain the sudoers-changes to be pre-checked | |
TMP=$(mktemp -t vagrant_sudoers) | |
cat /etc/sudoers > $TMP | |
cat >> $TMP <<EOF | |
# Allow passwordless startup of Vagrant when using NFS. | |
Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/su root -c echo '*' >> /etc/exports |
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 MissingTemplateException extends Exception {} | |
function render_template($template_file, $vars = array()) | |
{ | |
if(file_exists($template_file)) | |
{ | |
ob_start(); | |
extract($vars); | |
include($template_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 | |
/** | |
* Author : Jean-Sébastien Tremblay <jean-seb@total-itech.com> | |
* Description : Class for scalable, stateless and client-side sessions | |
*/ | |
/* Usage : | |
generate IV : | |
// do this only on time and save in config |
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
// When something changes | |
$("#changedSelectInput").foundationCustomForms(); |
OlderNewer