Skip to content

Instantly share code, notes, and snippets.

View msonnabaum's full-sized avatar

Mark Sonnabaum msonnabaum

  • Lithic
  • San Diego, CA
View GitHub Profile
<?php
require './core/vendor/autoload.php';
use Symfony\Component\Yaml\Parser;
function quantile($values, $p) {
sort($values);
$H = (count($values) - 1) * $p + 1;
$h = floor($H);
$v = $values[$h - 1];

Install XHProf

Pear

pear upgrade PEAR
pecl install xhprof-0.9.2

MAMP

<?php
function changed_functions() {
return array(
'field_invoke_method',
'field_invoke_method_multiple',
'_field_invoke',
'_field_invoke_multiple',
'field_attach_preprocess',
'field_info_extra_fields',
#!/usr/bin/env ruby
require 'bundler/setup'
require 'socket'
require 'eventmachine'
require 'tire'
require 'json'
require 'securerandom'
$stdout.sync = true
local keys = redis.call('hkeys', KEYS[1])
local ret = {}
for k,v in pairs(keys) do
if redis.call('hget', KEYS[1], v) == 'asdf' then
return v
end
end
#!/usr/bin/env ruby
require 'serialport'
class Maestro
def initialize
@sp = SerialPort.new("/dev/ttyACM0")
end
def send(servo, position)
<?php
class Kernel {
function handle() {}
}
class DrupalApp {
function __construct() {
$this->kernel = new Kernel();
}
#!/usr/bin/env ruby
require 'em-proxy'
Proxy.start(:host => "0.0.0.0", :port => 9201, :debug => false) do |conn|
conn.server :srv, :host => "127.0.0.1", :port => 9200
conn.on_data do |data|
puts data
data
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* This code is partially based on the Rack-Cache library by Ryan Tomayko,
* which is released under the MIT license.
*
<?php
namespace Drupal\Core;
use Symfony\Component\HttpKernel\HttpCache\HttpCache as SymfonyHttpCache;
class HttpCache extends SymfonyHttpCache {
protected function getOptions() {
return array(
'debug' => TRUE