Skip to content

Instantly share code, notes, and snippets.

@garnu
garnu / orientation-180-degrees-fix.js
Created May 5, 2013 18:34
Detect orientation change on iOS and Android + 180 degrees rotation fix for Android.
var orientation = (window.innerHeight > window.innerWidth)? "portrait" : "landscape";
$(window).on("orientationchange resize", checkOrientation);
var checkOrientation = function() {
var newOrientation = (window.innerHeight > window.innerWidth)? "portrait" : "landscape";
if(newOrientation == orientation) { return; } // no change
setInterval(checkOrientation, 1000); // recheck after 1 second for Android devices
orientation = newOrientation;
if(orientation == "portrait") {
// do something
}
@garnu
garnu / orientation.js
Last active December 17, 2015 00:29
Detect orientation change on iOS and Android
var orientation = (window.innerHeight > window.innerWidth)? "portrait" : "landscape";
$(window).on("orientationchange resize", checkOrientation);
var checkOrientation = function() {
var newOrientation = (window.innerHeight > window.innerWidth)? "portrait" : "landscape";
if(newOrientation == orientation) { return; } // no change
orientation = newOrientation;
if(orientation == "portrait") {
// do something
}
else { // portrait
@garnu
garnu / Gemfile
Created August 3, 2011 18:32
Bundle for jRuby on App Engine
# Critical default settings:
disable_system_gems
disable_rubygems
bundle_path ".gems/bundler_gems"
# List gems to bundle here:
gem "appengine-apis", "~>0.0.25"
gem "appengine-rack", "~>0.0.13"
gem "sinatra", "1.2.6"
gem "sinatra-reloader"
@garnu
garnu / CV.rb
Last active June 27, 2019 08:54
My Ruby CV
require 'rubygems'
%w(active_support active_record i18n).each{ |g| require g }
module Skills
def main
{
programming_languages: %w(Ruby Javascript Golang Bash),
development_frameworks: %w(Rails Node/Express.js Sinatra Grape React),
data_stores: %w(PostgreSQL MySQL Redis Cassandra Memcached),