Author: | Charles Childers |
---|---|
Date: | September 12, 2010 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with quotes' | |
( compare two strings from the beginning and return how many ) | |
( similar characters there are before the strings diverge. ) | |
: ^match ( $$-n ) | |
0 -rot repeat @+ [ swap @+ ] dip =if rot 1+ -rot else 2drop ;then again ; | |
( test each word in the dictionary for similarity. if similar up ) | |
( to the current point, add to the suggestions queue. ) | |
create list here , 100 allot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+__rvm_parse_args:778> [[ -n 4.3.11 ]] | |
+__rvm_parse_args:810> [[ -z '' && -n '' ]] | |
+__rvm_parse_args:812> [[ 0 -eq 1 || -n '' ]] | |
+__rvm_parse_args:14> [[ -n install ]] | |
+__rvm_parse_args:16> rvm_token=install | |
+__rvm_parse_args:18> (( 1 > 0 )) | |
+__rvm_parse_args:20> next_token=1.8.7 | |
+__rvm_parse_args:21> shift | |
+__rvm_parse_args:26> case install ([[:alnum:]]*|@*) | |
+__rvm_parse_args:30> case install (use) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def method(grid,root,rev = false) | |
grid.send(rev ? :reverse_each : :each) do |row| | |
row.send(rev ? :<< : :unshift, @num) | |
@num += 1 | |
end | |
new_row = [] | |
root.times do | |
new_row.send(rev ? :unshift : :<<, @num) | |
@num += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Regular Expression for URL validation | |
# | |
# Converted Diego Perini's regexp to ruby | |
# | |
# Author: James Robey | |
# Updated: 2013/02/07 | |
# | |
# Credits to Matt (mparodi) | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready -> | |
$(".simple_form").on("ajax:success", (e, data, status, xhr) -> | |
$(".list").append xhr.responseText | |
).bind "ajax:error", (e, xhr, status, error) -> | |
$(".list").prepend xhr.responseText |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserSerializer < ActiveModel::Serializer | |
attributes :id, :name, :phone, :email, :balance, :children, :balance | |
def attributes | |
data = super | |
data[:children] = User.find(data[:id]).subordinates.any? | |
data | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- days = 0..7 | |
- hours = 8..18 | |
%table | |
- days.each do |d| | |
%th= (Time.now + d.day).strftime("%A") | |
- hours.each do |h| | |
%tr | |
- days.each do |d| | |
%td= Time.parse("0001-01-01 #{h}:00:00 UTC").strftime '%l %p' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Gear | |
attr_reader :chainring, :cog, :wheel | |
def initialize(chainring, cog, rim, tire) | |
@chainring = chainring | |
@cog = cog | |
@wheel = Wheel.new(rim, tire) | |
end | |
def ratio | |
chainring / cog.to_f | |
end |
OlderNewer