Skip to content

Instantly share code, notes, and snippets.

View teliosdev's full-sized avatar
:shipit:

Jeremy Rodi teliosdev

:shipit:
View GitHub Profile
@teliosdev
teliosdev / gist:4519698
Created January 12, 2013 18:13
Steam's Currency Trading
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;
}
@teliosdev
teliosdev / rbinit_project.rb
Last active December 25, 2015 08:09
Creates a basic project for creating a ruby library.
#!/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|
thing = Some::HTTP::Thing.new("http://ruby-doc.org")
thing.callbacks = {
success: proc { puts "success!" },
failure: proc { puts "failed :(" },
error: proc { "umm?" }
}
thing.run!
require 'oj'
tmp = ary = []
100_000.times { tmp[0] = []; tmp = tmp[0] }
puts Oj.dump(ary)
@teliosdev
teliosdev / index.html
Last active August 29, 2015 13:58 — forked from Mechazawa/index.html
<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>
class Test
include Streamable
def output(thing)
p thing
end
end
Test.new.stream ["hello"], :output
require 'hashie'
puts "The hashie version is: #{Hashie::VERSION}"
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)
# ...
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]
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>]