Skip to content

Instantly share code, notes, and snippets.

View ayumi's full-sized avatar
🍅
ᕕ( ᐛ )ᕗ

ayumi  yu ayumi

🍅
ᕕ( ᐛ )ᕗ
View GitHub Profile
@ayumi
ayumi / thesocialnetwork.py
Created October 4, 2011 05:56
"social network" edit distance algorithm for causes.com
#-------------------------------------------------------------------------------
# Name: "social network" edit distance algorithm for causes.com
# Author: ayumi yu, 2011-10-03
# Licence: MIT license yeayahhh
#-------------------------------------------------------------------------------
#!/usr/bin/env python
# Imported fresh!
import string, codecs
@ayumi
ayumi / everlane_comm.py
Created October 7, 2011 02:28
new communication protocol checker for jesse farmer!
#-------------------------------------------------------------------------------
# new communication protocol checker for jesse farmer!
#
# Author: ayumi yu
# Created: 06.10.2011
# Last mod: 08.10.2011
# Licence: MIT
#-------------------------------------------------------------------------------
#!/usr/bin/env python
@ayumi
ayumi / stats.rb
Created March 23, 2012 05:20
Better rake:stats for Rails 3.x
# Originally from http://bit.ly/GIhZmg
# modified by @colour to reflect locations of assets in the asset pipeline
namespace :spec do
desc "Add files that DHH doesn't consider to be 'code' to stats"
task :statsetup do
require 'rails/code_statistics'
class CodeStatistics
alias calculate_statistics_orig calculate_statistics
@ayumi
ayumi / kawaii_phrase.rb
Created April 5, 2012 03:29
Random positive 3-word phrase generator (e.g. "Enjoyable Green Turtle")
module KawaiiPhrase
# Makes awesome random phrases such as "Enjoyable Green Turtle"
ADJ_1 = [
'epic',
'tasty',
'shiny',
'mega',
'ultra',
'hyper',
@ayumi
ayumi / .screenrc
Created November 7, 2012 23:23
ayumi's .screenrc
# ===============================================================
# ESCAPE - the COMMAND CHARACTER
# ===============================================================
# escape ^aa # default
# escape ^pp # suggested binding for emacs users
# escape ` # backtick
#
escape ``
@ayumi
ayumi / onValChange.js.coffee
Created November 13, 2012 21:21
[cs] Extend JQuery to bind changes in content, and skip general keypresses.
# Bind changes in content. Skip general keypresses.
$.fn.onValChange = (callback) ->
# IE < 9
usePropertyChange = true
this.on("propertychange.onValChange", (e) =>
callback.call(this) if (e.originalEvent.propertyName == "value")
return
)
@ayumi
ayumi / uneditable_form_tag.rb
Created November 28, 2012 23:45
conditionally uneditable form tag, extends Rails form helper
module ActionView
module Helpers
module FormTagHelper
def uneditable_tag(method, name, opts={})
if yield
send method, name, opts
else
value = defined?(object) ? object.send(name) : opts[:value]
content_tag :span, value, opts.merge({ :class => "uneditable-input #{opts.delete(:class)}" })
end
@ayumi
ayumi / .bash_profile
Created December 1, 2012 01:45
bash profile
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
@ayumi
ayumi / .bashrc
Last active October 13, 2015 10:08
bashrc
export PATH=/usr/local/bin:$PATH
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
# Git autocomplete
source ~/.git-completion.bash
# Git dirty state in prompt
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "*"
/*
* sprockets doesn't play well with SASS, dont use the default directives!
* (this one is cool)
*= require_self
*/
@import "lib/**/*";
@import "variables/**/*";
@import "styles/**/*";