Skip to content

Instantly share code, notes, and snippets.

View somebox's full-sized avatar
⌨️
coding nights

Jeremy Seitz somebox

⌨️
coding nights
View GitHub Profile
@somebox
somebox / application_controller.rb
Created May 3, 2012 11:51
rescue from routing errors
rescue_from ActionController::RoutingError do |exception|
render :file => Rails.root.join('public', '404.html'), :status => "404", :layout=>false
end
@somebox
somebox / i18ndocs.diff
Created May 9, 2012 06:32
i18ndocs changes
diff --git a/Gemfile b/Gemfile
index 34fced8..7edff29 100644
--- a/Gemfile
+++ b/Gemfile
@@ -16,6 +16,8 @@ group :development do
gem "bundler", ">= 1.0.0"
gem "jeweler", ">= 1.8.3"
gem "simplecov",">= 0.5"
+ gem "fastercsv"
+ gem "i18n"
>> h={a:true,b:false,c:1}
=> {:a=>true, :b=>false, :c=>1}
>> h[:a].present?
=> true
>> h[:a].presence
=> true
>> h[:b].present?
=> false
>> h[:b].presence
=> nil
@somebox
somebox / why_utc.md
Last active March 9, 2016 11:09
Why use UTC for DB, APIs, Services... in Switzerland?
  • UTC is best practice http://stackoverflow.com/questions/2532729/daylight-saving-time-and-time-zone-best-practices
  • DST changes can causes issues with things like opening hours, publication dates on contracts, etc... UTC helps avoid this
  • embrace the pattern: UTC on systems and APIs, TZ display in UI/UX and outputs
  • integrations with partners, 3rd-party services (think Amazon, Google Cloud computing, pub/sub services, filepicker... all will use UTC)
  • you trade "easier to think about" for "subtle bugs and weird test fails" in the future
  • people assuming we're standard UTC like the rest of the world might set up servers/services in CEST and be off by an hour (past example: localina!)
  • someday you will work for a company that does things outside of Switzerland. You should learn this :)
@somebox
somebox / redis-graphite.sh
Last active July 18, 2016 00:37
graphite-redis : monitor redis statistics with graphite across several hosts
#!/usr/bin/env ruby
require 'socket'
# This script runs every minute, captures stats about redis
# and forwards them to graphite as counter values.
# Graphite/carbon settings
GRAPHITE_HOST="graphite.intra.local.ch"
GRAPHITE_PORT=8125
@somebox
somebox / tamedia-freelance.md
Last active October 30, 2016 12:47
Tamedia Digital - Freelance Outreach

Tamedia Digital - Freelance Opportunities

Jeremy Seitz, Tamedia Core Engineering, Oct 2016

About Tamedia Digital and Core Engineering

Tamedia is the company behind many well-known online Swiss brands, such as 20min, Starticket, Ricardo, Doodle, Homegate, and many others. Core Engineering is a small expert tech consulting group that serves these companies, working closely with engineering teams across the company. Through project work, architecture, training, events, and providing resources, we help the companies of Tamedia bring speed and agility to their engineering efforts.

A Growing Freelance Network

One of the functions of Core Engineering is to build relationships with freelancers and tech agencies in Switzerland. We make it easier for freelancers to work with the different companies in Tamedia, through close collaboration, simplifying contract and billing processes, more flexible placement, access to services and resources, and communication with key contacts across the organizatio

@somebox
somebox / README
Created September 20, 2011 23:47 — forked from indirect/README
Update WebKit nightly
To use this:
1. check out the gist somewhere
2. edit the plist to contain the path to the .rb file
3. run this:
chmod +x update-webkit.rb
launchctl load com.indirect.update-webkit.plist
@somebox
somebox / jquery.disable.js
Created September 20, 2011 11:42
jQuery snippet to make page elements unselectable (disable highlights)
/* disable user selections */
jQuery.fn.disableSelection = function(){
$(this).each(function(){
$(this).attr('unselectable', 'on')
.css('-moz-user-select', 'none')
.each(function() {
this.onselectstart = function() { return false; };
});
});
function debug(){
if (typeof console != "undefined"){
if (console.log){
if (arguments.length == 1){
console.log(arguments[0]);
} else {
console.log(arguments);
}
}
}
@somebox
somebox / unicorn-graphite.rb
Created November 12, 2013 13:03
Graphing unicorn active/queued processes (via sockets)
#!/usr/bin/env ruby
require 'rubygems'
require 'raindrops'
require 'statsd'
#
# This script monitors the active and queued unicorn processes.
# It uses the raindrops gem to look at the unix domain socket.
# Stats are polled every second (for one minute) and pushed to
# statsd as a counter. This script runs once a minute.