Skip to content

Instantly share code, notes, and snippets.

Tim Timrael

Block or report user

Report or block Timrael

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:c006b5a5ee9673c5fa7f
<link id="font" href="http://fonts.googleapis.com/css?family=Open+Sans:400,600&subset=latin,cyrillic" rel="stylesheet" media="none" onload="setTimeout(function(){document.getElementById('font').setAttribute('media', 'all')}, 0)">
@Timrael
Timrael / gist:11406259
Created Apr 29, 2014
TRF dump example
View gist:11406259
[{
"field": "children",
"op": "EQ",
"children": {
"0": [{
"field": "infants",
"op": "EQ",
"children": {
"0": [{
"field": "trip_class",
View search.rb
module HotelsApi
class Search
include NanoApi::Model
HOTELSCOMBINED_MAP = {
:search => :destination,
:file_name => :fileName,
:checkin => :depart_date,
:checkout => :return_date,
:rooms => :rooms,
View add_to_cart.rb
require_relative "inet2"
puts ARGV
cart = Cart.new(ARGV.delete_at(0))
ARGV.each do |argument|
@items.each { |item| cart.add_expensive_item(item) if argument == item.name }
end
cart.save_to_file
View Firefox bug with location.hash
>>> window.location.hash = "%25255B";
"%25255B"
>>> window.location.hash = window.location.hash;
"#%255B"
>>> window.location.hash = window.location.hash;
@Timrael
Timrael / rspec-syntax-cheat-sheet.rb
Created Jul 19, 2012 — forked from dnagir/rspec-syntax-cheat-sheet.rb
RSpec 2 syntax cheat sheet by example
View rspec-syntax-cheat-sheet.rb
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
View gist:2947172
class Foo
def self.bar
puts "Hello, world!"
end
end
module Monkey
def self.included(base)
base.extend(ClassMethods)
base.class_eval do
@Timrael
Timrael / gist:2947135
Created Jun 18, 2012
Monkey Patching
View gist:2947135
class Foo
def bar
puts "Hello, world!"
end
end
module Monkey
def self.included(base)
base.send(:include, InstanceMethods)
base.class_eval do
View gist:1939102
notified << author if author && author.active? && author.notify_about?(self)
if assigned_to
if assigned_to.is_a?(Group)
notified += assigned_to.users.select {|u| u.active? && u.notify_about?(self)}
else
notified << assigned_to if assigned_to.active? && assigned_to.notify_about?(self)
end
end
View gist:1716729
Redmine::Plugin.register :redmine_xxx do
settings :default => { 'default_tracker_for_new_issue' => Tracker.first.id }
end
# 'Setting.plugin_redmine_xxx' will output '"default_tracker_for_new_issue1"'
Redmine::Plugin.register :redmine_xxx do
You can’t perform that action at this time.