This file contains hidden or 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
case 6: | |
var template = null; | |
var bAmountChanged = false; | |
var newAmount = parseInt( event.amount ); | |
var oldAmount = parseInt( event.old_amount ); | |
if ( event.amount == 0 ) | |
{ | |
template = bTheirAction ? EventLogRemoveThemTemplate : EventLogRemoveYouTemplate; | |
} |
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'fileutils' | |
def init_project(project_name, user_name, user_email, directory) | |
project_directory = File.join(directory, | |
project_name.gsub("-", "/")).gsub("./", "") | |
project_const = project_name.gsub(/_([a-z])/) do |match| |
This file contains hidden or 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
thing = Some::HTTP::Thing.new("http://ruby-doc.org") | |
thing.callbacks = { | |
success: proc { puts "success!" }, | |
failure: proc { puts "failed :(" }, | |
error: proc { "umm?" } | |
} | |
thing.run! |
This file contains hidden or 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
require 'oj' | |
tmp = ary = [] | |
100_000.times { tmp[0] = []; tmp = tmp[0] } | |
puts Oj.dump(ary) |
This file contains hidden or 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
<html> | |
<head> | |
<title>Sierpinski triangles in Liquidscript</title> | |
<script src="triangles.js"></script> | |
<style>html { background-color: #f9f9f9; }</style> | |
</head> | |
<body onload="sierpinski(256)"> | |
<canvas id="result" width="800" height="800"></canvas> | |
</body> | |
</html> |
This file contains hidden or 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 Test | |
include Streamable | |
def output(thing) | |
p thing | |
end | |
end | |
Test.new.stream ["hello"], :output |
This file contains hidden or 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
require 'hashie' | |
puts "The hashie version is: #{Hashie::VERSION}" |
This file contains hidden or 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
post_comments = Hash.new | |
def find_comments_for(post_id) | |
post_commends.fetch(post_id) do | |
post_comments[post_id] = fetch_comments(post_id) | |
end | |
end | |
def fetch_comments(post_id) | |
# ... |
This file contains hidden or 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
module Liquidscript | |
module AST | |
class Node | |
class << self | |
# Define a child node for this node. It accepts a name. | |
# | |
# @param name [Symbol] the name of the child. | |
# @return [void] |
This file contains hidden or 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
module Liquidscript | |
class Parser | |
module PredictMatch | |
# Makes a prediction based on a set of actions. If the peek token | |
# doesn't have an action, it will try the special action `:_`, and | |
# then give up. If it finds a corresponding action either time, it | |
# will run the action. | |
# | |
# @param actions [Hash<Symbol => Symbol>] |
OlderNewer