Skip to content

Instantly share code, notes, and snippets.

@dsapala
dsapala / gist:9943408
Created April 2, 2014 21:19
binding ns
(binding [*ns* 'migrator.db.old-entities]
(let [db (get-connection (:old-db system))]
(defentity user
(database db)
(table "user")
(entity-fields :id :email :first_name :last_name))))
@dsapala
dsapala / my_app_money.rb
Created January 29, 2012 20:24 — forked from nilakanta/my_app_money.rb
Use Money gem with mongoid (works with mongoid 2.1.0 and higher)
module MyApp
class Money
include Mongoid::Fields::Serializable
def cast_on_read?; true; end
def deserialize(object)
return nil if object.blank?
::Money.new(object[:cents] || object["cents"], object[:currency] || object["currency"])
end
@dsapala
dsapala / my_app_money.rb
Created February 5, 2012 18:49 — forked from nilakanta/my_app_money.rb
Use Money gem with mongoid (works with mongoid 2.1.0 and higher)
module MyApp
class Money
include Mongoid::Fields::Serializable
def cast_on_read?; true; end
def deserialize(object)
return nil if object.blank?
::Money.new(object[:cents] || object["cents"], object[:currency] || object["currency"])
end
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
/usr/local/rvm/gems/ruby-1.9.2-p180@global/bin/passenger-config
This file has been truncated, but you can view the full file.
==> Downloading http://www.php.net/get/php-5.3.10.tar.bz2/from/this/mirror
Already downloaded: /Users/dsapala/Library/Caches/Homebrew/php-5.3.10
/usr/bin/tar xf /Users/dsapala/Library/Caches/Homebrew/php-5.3.10
==> Patching
/usr/bin/patch -f -p1 -i 001-homebrew.diff
patching file ext/tidy/tidy.c
==> ./configure --prefix=/usr/local/Cellar/php/5.3.10 --disable-debug --with-config-file-path=/usr/local/etc --with-config-file-scan-dir=/usr/local/etc/php5/conf.d --with-iconv-dir=/usr --enable-dba --with-ndbm=/usr --enable-exif --enable-soap --enable-sqlite-utf8 --enable-wddx --enable-ftp --enable-sockets --enable-zip --enable-pcntl --enable-shmop --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-mbstring --enable-mbregex --enable-zend-multibyte --enable-bcmath --enable-calendar --with-openssl=/usr --with-zlib=/usr --with-bz2=/usr --with-ldap --with-ldap-sasl=/usr --with-xmlrpc --with-kerberos=/usr --with-libxml-dir=/usr/local/Cellar/libxml2/2.7.8 --with-xsl=/usr --with-curl=/usr --with-gd --enable-gd-nati
@dsapala
dsapala / gist:2276778
Created April 1, 2012 16:25
gcc -v output
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)
@dsapala
dsapala / hack.sh
Created April 1, 2012 20:35 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@dsapala
dsapala / namespace.coffee
Created April 6, 2012 11:02
namespaces on coffeescript
#
# http://stackoverflow.com/questions/8730859/classes-within-coffeescript-namespace
# from https://github.com/jashkenas/coffee-script/wiki/FAQ
# Code:
#
namespace = (target, name, block) ->
[target, name, block] = [(if typeof exports isnt 'undefined' then exports else window), arguments...] if arguments.length < 3
top = target
target = target[item] or= {} for item in name.split '.'
block target, top
@dsapala
dsapala / index.html
Created March 25, 2016 22:17 — forked from jazzido/index.html
Webcam barcode reading (zbar, emscripten)
<!DOCTYPE html>
<html>
<head>
<title>JS in-browser barcode reader</title>
<style type="text/css">
body > div {
position: relative;
width: 320px; height: 240px;
}
video { position: absolute; top: 0; left: 0; width: 320px; height: 240px; }
### Keybase proof
I hereby claim:
* I am dsapala on github.
* I am dsapala (https://keybase.io/dsapala) on keybase.
* I have a public key whose fingerprint is C79E 25C8 9B58 43AD 6DA6 4354 244B 24E1 A250 4ABB
To claim this, I am signing this object: