Skip to content

Instantly share code, notes, and snippets.

View jirihradil's full-sized avatar
🦄

Jiri Hradil jirihradil

🦄
  • Invoice Home Inc.
  • Austin, TX
View GitHub Profile
@jirihradil
jirihradil / colors.css
Created July 3, 2015 13:30
Charles Blanc's 12 colors scheme
/*
Charles Blanc's 12 colors scheme
rgb mapping via https://upload.wikimedia.org/wikipedia/commons/5/55/Color_star-en.svg
*/
.red { color: rgb(255, 0, 0) }
.red-orange { color: rgb(250, 59, 12) }
.orange { color: rgb(247, 134, 9) }
@jirihradil
jirihradil / rails pg gem.sh
Last active August 29, 2015 14:24
Rails, rucni instalace pg gem, pokud neprojde automaticka pres bundler
gem install pg -v '0.18.2' -- --with-pg-config=/usr/pgsql-9.4/bin/pg_config
@jirihradil
jirihradil / gist:1a87acfda39dfe999b1d
Created January 17, 2012 21:56
rails STI form_for
<% form_for(:invoice, @invoice, :url => {:action=>'update'}, :html => { :method => :put }) do |f| %>
@jirihradil
jirihradil / gist:d695b308578bd9d0c594
Last active September 26, 2015 05:48
Javascript a odpočítávání startu
<script language="JavaScript">
var timerID = null;
var timerRunning = false;
function showtime() {
today = new Date();
BigDay = new Date("october 6, 2011 10:00:00")
msPerDay = 24 * 60 * 60 * 1000 ;
timeLeft = (BigDay.getTime() - today.getTime());
e_daysLeft = timeLeft / msPerDay;
daysLeft = Math.floor(e_daysLeft);
@jirihradil
jirihradil / gist:141c85d60f6c80605690
Created June 17, 2011 09:49
Active Record a stavění dotazů
class Site < ActiveRecord::Base
def self.build_conditions(ids, name=nil, state=nil)
cond = []
cond << send(:sanitize_sql_array, ["id NOT IN (?)", ids]) unless ids.empty?
cond << send(:sanitize_sql_array, ["name = ? ", name]) unless name
cond << send(:sanitize_sql_array, ["state = ? ", state]) unless state
cond.join(" and ")
end
end
@jirihradil
jirihradil / gist:762db432b1c4276a4ef8
Created May 18, 2011 16:01
Ruby nahodne 10-mistne cislo
1000000000 + rand(9000000000)
@jirihradil
jirihradil / gist:ad2d4474a46101e80656
Created May 16, 2011 20:00
sunspot solr, OR condition
Sunspot.search(Post) do
any_of do
with(:expired_at).greater_than(Time.now)
with(:expired_at, nil)
end
end