Skip to content

Instantly share code, notes, and snippets.

View fform's full-sized avatar

Will Froelich fform

View GitHub Profile
@fform
fform / gist:3124201
Created July 16, 2012 18:34
Javascript list sort speed comparison
function quicksort( arr ){
if(arr.length <= 1){
return arr;
}
var pos = Math.round( Math.round(arr.length / 2) );
var pivot = arr.splice( pos, 1 );
var less = [], more = [];
for(var i in arr){
if(arr[i] > pivot){
more.push( arr[i] );
@fform
fform / gist:3139726
Created July 18, 2012 23:42
Get all objects in the browser ignoring browser globals
//Gather
// First run this in a "clean" browser window to gather a list of objects the browser normall makes
(function(){
var dd = [];
for(var i in window){
dd.push(i);
};
var ddt = RegExp(dd.join('|'),'g');
console.log(ddt);
#!/usr/bin/php
<?php
define('NL',"\n");
$arg = (empty($argv[1]) ? "" : $argv[1]);
function capture_cmd($cmd){
$output = array();
exec($cmd, $output);
Generated at 2013-03-13 21:06:03 +0000
Chef::Exceptions::Exec: package[elinks] (networking_basic::default line 8) had an error: Chef::Exceptions::Exec: apt-get -q -y install elinks=0.12~pre5-7ubuntu1 returned 100, expected 0
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/mixin/command.rb:128:in `handle_command_failures'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/mixin/command.rb:75:in `run_command'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/mixin/command.rb:143:in `run_command_with_systems_locale'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/provider/package/apt.rb:97:in `install_package'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/provider/package.rb:82:in `block in action_install'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/mixin/why_run.rb:52:in `call'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/mixin/why_run.rb:52:in `add_action'
/opt/chef/embedded/lib/ruby/gems/
@fform
fform / gist:5259003
Created March 27, 2013 23:13
Sketch Textures and Templates
@fform
fform / gist:5374586
Created April 12, 2013 19:46
Sketch css gradient bug in chrome
<html>
<head>
<title>Demo</title>
</head>
<style type="text/css">
.square{
display:block;
width:150px;
height:150px;
}
@fform
fform / gist:6084182
Created July 25, 2013 22:01
Force Facebook comment plugin and twitter to respect fluid container
.fb-comments,
.fb-comments iframe[style],
.fb_iframe_widget > span[style] {
width: 100% !important;
}
.twitter-tweet {
width: 100% !important;
}
@fform
fform / update-node.sh
Last active December 20, 2015 09:19
Auto download and install node based on specified version. Tested on Ubuntu 12 x64
if [ "$1" == "" ]; then
echo "You need to specify version like 0.10.0.15"
exit
fi
nodev="node-v$1-linux-x64"
package="$nodev.tar.gz"
echo "Downloading to $1"
alert('hello world!!!');
@fform
fform / gitsite-setup.php
Last active August 29, 2015 13:56
Git Apache Vhost Setup
#!/usr/bin/php
<?php
define('NL',"\n");
define('FILE_PRSCRIPT_PATH', '/usr/local/scripts/');
define('FILE_PRSCRIPT', '/usr/local/scripts/pullrepo');
if($argv[0] == __FILE__ OR $argv[0] == basename(__FILE__)){
array_shift($argv);