Skip to content

Instantly share code, notes, and snippets.

View msroot's full-sized avatar
:octocat:

Yannis Kolovos msroot

:octocat:
View GitHub Profile
<html>
<head>
<title>Total tweets</title>
<style type="text/css">
/*
input {
float: left;
clear: both;
}
*/
@msroot
msroot / gist:3884918
Created October 13, 2012 15:01
window orientationchange
jQuery(window).bind('orientationchange', function(e) {
switch ( window.orientation ) {
case 0:
alert('portrait mode');
break;
case 90:
alert('landscape mode screen turned to the left');
@msroot
msroot / gist:3926800
Created October 21, 2012 11:53
js profiler
if (window.console && window.console.profile) {
console.profile("label for profile");
// insert code to profile here,
// all function calls will be profiled
console.profileEnd();
}
@msroot
msroot / gist:3938435
Created October 23, 2012 12:14
Voting Emulator Task
#Save in lib/taks/emulator.rake
#after run rake emulate:mobile
require 'rubygems'
require 'active_support'
require 'logger'
namespace :emulate do
desc "Emulate realtime votes for mobile poll view"
@msroot
msroot / gist:3944183
Created October 24, 2012 05:27
pretty_routes rake
desc 'Pretty print out all defined routes in match order, with names. Target specific controller with CONTROLLER=x.'
task :pretty_routes => :environment do
all_routes = ENV['CONTROLLER'] ? Fanhub::Application.routes.select { |route| route.defaults[:controller] == ENV['CONTROLLER'] } : Fanhub::Application.routes
routes = all_routes.routes.collect do |route|
reqs = route.requirements.empty? ? "" : route.requirements.inspect
{:name => route.name, :verb => route.verb, :path => route.path, :reqs => reqs}
end
File.open(File.join(Rails.root, "routes.html"), "w") do |f|
f.puts "<html><head><title>Rails 3 Routes</title></head><body><table border=1>"
f.puts "<tr><th>Name</th><th>Verb</th><th>Path</th><th>Requirements</th></tr>"
#{request.protocol}#{request.host_with_port}#{request.fullpath}
#############################################################
# FUCK
# Listen and write some poetry
#############################################################
begin
File.open("http://www.youtube.com/watch?v=goeOUTRy2es&list=RD02KpOtuoHL45Y")
rescue SetFocusError
end
// curl -X POST -d url="http://www.orangelt.us/info/wp-content/uploads/2010/08/OrangeLT_White_Background.jpg" // https://www.filepicker.io/api/store/S3?key=KEY
var filepicker_url = "https://www.filepicker.io/api/store/S3?key=KEY"
var images = [
"http://www.orangelt.us/info/wp-content/uploads/2010/08/OrangeLT_White_Background.jpg",
"http://www.aussieapples.com.au/media/images/galleries/apple-photo-gallery/pink_lady_apple.jpg"
];
$.each(images, function(k, v) {
var filepicker_url = "https://www.filepicker.io/api/store/S3?key=KEY"
var images = [
"http://www.orangelt.us/info/wp-content/uploads/2010/08/OrangeLT_White_Background.jpg",
"http://www.aussieapples.com.au/media/images/galleries/apple-photo-gallery/pink_lady_apple.jpg"
];
$.each(images, function(k, v) {
var
// A central reference to the root jQuery(document)
rootjQuery,
// The deferred used on DOM ready
readyList,
// Support: IE9
// For `typeof xmlNode.method` instead of `xmlNode.method !== undefined`
core_strundefined = typeof undefined,