Skip to content

Instantly share code, notes, and snippets.

@haileys
haileys / code.rb
Last active January 2, 2016 01:49 — forked from SamSaffron/gist:8232978
module MA; end
module MB; end
module MC; end
module MD; end
module ME; end
class A; end
class B < A
include MA
@haileys
haileys / Makefile
Created September 25, 2013 05:21 — forked from steveklabnik/Makefile
all: rust-for-rubyists.epub site
rust-for-rubyists.epub:
pandoc --toc -S -s --epub-metadata=book/metadata.xml -o rust-for-rubyists.epub book/title.txt book/preamble.md book/chapter-*.md
site:
pandoc -S -s book/preamble.md book/chapter-*.md -o book/book.html --include-before-body=book/header.html --include-after-body=book/footer.html
pandoc -S -s book/chapter-01.md -o book/chapter-01.html --include-before-body=book/header.html --include-after-body=book/footer.html
pandoc -S -s book/chapter-02.md -o book/chapter-02.html --include-before-body=book/header.html --include-after-body=book/footer.html
pandoc -S -s book/chapter-03.md -o book/chapter-03.html --include-before-body=book/header.html --include-after-body=book/footer.html
@haileys
haileys / trololol.rb
Last active December 21, 2015 06:29 — forked from tenderlove/trololol.rb
module Kernel
def int(mid)
meth = instance_method(mid)
define_method(mid) { |*args, &bk|
val = meth.bind(self).call(*args, &bk)
raise TypeError, "#{mid} did not return an Integer" unless val.is_a? Integer
val
}
mid
end
@haileys
haileys / sphinx.rb
Last active December 10, 2015 12:08 — forked from stefanoverna/sphinx.rb
require 'formula'
class Sphinx < Formula
url 'http://sphinxsearch.com/downloads/sphinx-0.9.9.tar.gz'
homepage 'http://www.sphinxsearch.com'
md5 '7b9b618cb9b378f949bb1b91ddcc4f54'
head 'http://sphinxsearch.googlecode.com/svn/trunk/'
fails_with_llvm "fails with: ld: rel32 out of range in _GetPrivateProfileString from /usr/lib/libodbc.a(SQLGetPrivateProfileString.o)"
@haileys
haileys / MIS.php
Created August 30, 2012 07:38 — forked from anonymous/MIS
<?php
require_once("../CoreSection/database.inc.php");
require_once("RequireFunctions.php");
function UpdateTimeStamp($TimeStamp, $TableName, $idCompany, $DatabaseObject)
{
$QueryCondition = "idCompany = " . $idCompany ." and TableName = " . $TableName;
$SelectStatus = $DatabaseObject->select("tablestimestamp", "TimeStamp", $QueryCondition);
/*
$Error = $DatabaseObject->getError();
if(isset($Error) && !empty($Error))//if(!$SelectStatus)
@haileys
haileys / gist:2785862
Created May 25, 2012 05:03 — forked from jacobh/gist:2785812
Django ajax csrf coffeescript
document = cookie: "hello=world;this=that;what=which"
getCookie = (name) ->
if document.cookie
for [_, k, v] in (/^(.*?)=(.*)$/.exec kv for kv in document.cookie.split ";")
if k is name
return decodeURIComponent v
console.log getCookie "this"
@haileys
haileys / best-haskell.hs
Created May 5, 2012 03:30 — forked from jacobh/pretty-python.py
OOPD 110 test 2
monthWeight m = do
putStr $ "input weight for month #" ++ show m ++ ": "
readLn
main = do
weights <- mapM monthWeight [1..12]
putStrLn $ "average weight is: " ++ (show $ sum weights `div` length weights)
@haileys
haileys / gist:2340780
Created April 9, 2012 01:51 — forked from SamSaffron/gist:2340416
MiniProfiler API test
class Animal
def walk(distance, unit)
sleep 0.1
puts "walked #{distance} #{unit}"
end
end
class Dog < Animal
end
Harbour.prototype.parseTargets = function(callback) {
var longestIP, longestHost;
var newTargets = [];
var oldTargets = this.options.targets.split(',');
var remaining = oldTargets.length;
oldTargets.forEach(function(target){
if(net.isIP(target)){
dns.reverse(target, function(err, domains){
newTargets.push([(domains ? domains[0] : ''), target]);
Harbour.registerPlugin({
name: "Harbour HTTP",
foo: function(...) { ... },
....
});