Skip to content

Instantly share code, notes, and snippets.

@cj
cj / app.rb
Created February 21, 2014 19:56
Cuba.define do
on get, 'assets' do
run Assets::Routes
end
on root do
res.write view("home/index")
end
end
@cj
cj / hash.rb
Created March 4, 2014 05:06 — forked from rmw/hash.rb
class Hash
# options:
# :exclude => [keys] - keys need to be symbols
def to_ostruct_recursive(options = {})
convert_to_ostruct_recursive(self, options)
end
private
def convert_to_ostruct_recursive(obj, options)
result = obj
#!/bin/bash
if [[ -f .env ]]; then
eval "$(awk '/^[A-Z]/ { print "export " $0 }' .env)"
if [[ $# -gt 0 ]]; then
"$@"
elif [[ -z $PS2 ]]; then
$SHELL
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@cj
cj / Gemfile
Last active August 29, 2015 14:25
gem 'roda', '2.5.0'
gem 'wedge', github: 'wedge/wedgeio'
bind_search_license: function(){
$("#search-license").click(function(){
var t$ = $("#shop_license");
$.ajax({
type:'get',
dataType:'json',
url:'/auth/search_license',
cache:false,
data:{ license: t$.val() },
success: function(){
<?php
function normalize ($string) {
$table = array(
'Š'=>'S', 'š'=>'s', 'Đ'=>'Dj', 'đ'=>'dj', 'Ž'=>'Z', 'ž'=>'z', 'Č'=>'C', 'č'=>'c', 'Ć'=>'C', 'ć'=>'c',
'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A', 'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E', 'É'=>'E',
'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I', 'Ï'=>'I', 'Ñ'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O',
'Õ'=>'O', 'Ö'=>'O', 'Ø'=>'O', 'Ù'=>'U', 'Ú'=>'U', 'Û'=>'U', 'Ü'=>'U', 'Ý'=>'Y', 'Þ'=>'B', 'ß'=>'Ss',
'à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'a', 'å'=>'a', 'æ'=>'a', 'ç'=>'c', 'è'=>'e', 'é'=>'e',
'ê'=>'e', 'ë'=>'e', 'ì'=>'i', 'í'=>'i', 'î'=>'i', 'ï'=>'i', 'ð'=>'o', 'ñ'=>'n', 'ò'=>'o', 'ó'=>'o',
" http://github.com/solars/github-vim/
" sol@textmode.at
if exists("loaded_github") || &cp
finish
endif
" --- main functions --- "
function! s:RelPath()
if !exists('b:rel_path')
let root = escape('$PWD')
let file = expand('%:p')
let b:rel_path = strpart(file,matchend(file, root))
endif
return b:rel_path
endfunction
# If X aka bomb is pressed then
if ig.input.state 'bomb'
console.log 'bombs away'