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
# define global variables here | |
# define methods here | |
# for human | |
user_cards = 0 | |
card_one = rand(1..11) | |
card_two = rand(1..11) | |
# for computer | |
cpu_cards = rand(1..11) |
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
Show hidden characters
{ | |
"cmd": ["mcs", "$file", "-r:System.Windows.Forms.dll", "-r:System.Drawing.dll"], | |
"file_regex": "^(.*?)\\(([0-9]+),([0-9]+)\\): (.*)$", | |
"selector": "source.csharp" | |
} |
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
queue_names = "aggregations,xml_generation,profile_generation,trip,billing,flume,end,snap,profile_analysis,etl,report_api,events,pipeline_entry,profile_aggregation,geocoder".split(",") | |
queues = {} | |
queue_names.each do |name| | |
queues[name] = [] | |
end | |
Resque.working.each do |x| | |
name = x.job["queue"] | |
queue = queues[name] |
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
queues = Hash.new { |h, k| h[k] = [] } | |
Resque.working.each do |x| | |
queues[x.job["queue"]] << x.job["run_at"] | |
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
queues = Hash.new { |h, k| h[k] = [] } | |
Resque.working.each do |x| | |
queues[x.job["queue"]] << x.job["run_at"] | |
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
% irb | |
ruby-1.9.3-p327 :001 > ++ | |
ruby-1.9.3-p327 :002 > ++ | |
ruby-1.9.3-p327 :003 > ++ | |
ruby-1.9.3-p327 :004 > 5 | |
=> 5 | |
ruby-1.9.3-p327 :005 > x = 3 | |
=> 3 | |
ruby-1.9.3-p327 :006 > x++ | |
ruby-1.9.3-p327 :007 > 2 |
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
# This is a program trying to implement Verbal Expressions | |
# See this for more info - http://verbalexpressions.github.io/ | |
def VerEx | |
VerExClass.new | |
end | |
class VerExClass | |
attr_accessor :regex | |
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 TutorsController < ApplicationController | |
before_action :authenticate_user! | |
respond_to :html | |
def new | |
@tutor = current_user.build_tutor | |
respond_with @tutor | |
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
curl http://localhost:3000/users -d '{"user": { "first_name": "Abhishek", "login_info_attributes": { "password": "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
datetime = DateTime.parse('2013-07-14T09:00') | |
tz = datetime.in_time_zone # => Sun, 14 Jul 2013 09:00:00 UTC +00:00 | |
tz.instance_variable_set(:@time_zone, ::Time.find_zone!("CET")) | |
tz.instance_variable_set(:@period, tz.send(:get_period_and_ensure_valid_local_time)) | |
tz # => Sun, 14 Jul 2013 09:00:00 CEST +02:00 | |
# :-) |
NewerOlder