Skip to content

Instantly share code, notes, and snippets.

View Meekohi's full-sized avatar

Michael Holroyd Meekohi

View GitHub Profile
@Meekohi
Meekohi / gist:3144049
Created July 19, 2012 13:49
Set amazon ACL on a folder
files = @s3.list_bucket Rails.application.settings[ :s3_bucket ], {:prefix => short_id}
files.each do |key|
s3.put_acl Rails.application.settings[ :s3_bucket ], key, nil, {'x-amz-acl' => 'public-read'}
end
@Meekohi
Meekohi / gist:3874823
Created October 11, 2012 19:16
permissions error during brew install parallel
$ HOMEBREW_MAKE_JOBS=1 VERBOSE=1 brew install parallel
==> Downloading http://ftpmirror.gnu.org/parallel/parallel-20120622.tar.bz2
Already downloaded: /Library/Caches/Homebrew/parallel-20120622.tar.bz2
/usr/bin/tar xf /Library/Caches/Homebrew/parallel-20120622.tar.bz2
==> ./configure --prefix=/usr/local/Cellar/parallel/20120622
./configure --prefix=/usr/local/Cellar/parallel/20120622
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
@Meekohi
Meekohi / bundler mysql2 error
Created January 30, 2013 16:35
bundler mysql2 error
Installing mysql2 (0.3.11) with native extensions ......
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... no
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
have_header: checking for mysql.h... -------------------- no
"gcc -E -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I. -I/usr/include/mysql55 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BIT
S=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexce
ptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing -fno-stack-protector -fPIC conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include <mysql.h>
/* end */
git gc
git fsck --full
git reflog expire --expire=0 --all
git update-ref -d 0d998c99b6d01e8aabca72b1934802acf90b8fc9
git gc --aggressive
git remote update --prune
@Meekohi
Meekohi / gist:5172099
Created March 15, 2013 18:48
Snippet for animating data on "Streams" d3.js demo
<!DOCTYPE html>
<meta charset="utf-8">
<style>
path {
stroke: #000;
fill-opacity: .8;
}
</style>
function scrapePage(names){
var facts;
if(names.length <= 0) phantom.exit();
var name = names.shift(); //shortens the array and returns an item
page2.open(name, function(status) {
console.log("wtf on " + name);
//do work here
@Meekohi
Meekohi / gist:5357689
Created April 10, 2013 19:29
Attempt at monkeypatching casper
casper.fetchTextArray = function fetchTextArray(selector) {
console.log(this);
var text = '';
var elements = this.findAll(selector);
if (elements && elements.length) {
Array.prototype.forEach.call(elements, function _forEach(element) {
if(text === '')
text = element.textContent || element.innerText;
else
text = [text].push(element.textContent || element.innerText);
{
"name": "Andrew B Abel",
"title": [
"Ronald A. Rosenfeld Professor",
"Department Chair"
],
"biography": "Education\nPhD, Massachusetts Institute of Technology, 1978; AB, Princeton University, 1974\nCareer and Recent Professional Awards; Teaching Awards\nFellow, Econometric Society, 1991; John Kenneth Galbraith Award, Harvard University, 1984; MBA Core Curriculum Cluster Award, 1996-97\nAcademic Positions Held\nWharton: 1986-present (named Ronald A. Rosenfeld Professor, 2003; Robert Morris Professor of Banking, 1989-2003; Ronald O. Perelman Professor of Finance, 1988-89; Amoco Term Professor of Finance, 1986-88). Previous appointments: Harvard University; University of Chicago. Visiting appointments: Tel Aviv University; The Hebrew University of Jerusalem\nOther Positions\nResearch Associate, National Bureau of Economic Research, 1983-; Member, Long-Term Modeling Group, Congressional Budget Office, 2001; Member Panel of Economic Advisers, Congressional Budget Office, 2001-2005; Member, Techni
[info] Updating {file:/Users/meekohi/knollop/knollop/scala/knollop/}auth...
[info] Resolving org.scala-lang#scala-reflect;2.10.0 ...
[warn] [NOT FOUND ] org.slf4j#slf4j-api;1.6.6!slf4j-api.jar (0ms)
[warn] ==== local: tried
[warn] /Users/meekohi/play-2.1.1/repository/local/org.slf4j/slf4j-api/1.6.6/jars/slf4j-api.jar
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: FAILED DOWNLOADS ::
[warn] :: ^ see resolution messages for details ^ ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.slf4j#slf4j-api;1.6.6!slf4j-api.jar