Skip to content

Instantly share code, notes, and snippets.

Georgios Kaleadis georgiee

Block or report user

Report or block georgiee

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
@pixeltrix
pixeltrix / routes.rb
Created Oct 29, 2010
Examples of advanced Rails 3.0 routes
View routes.rb
Rails.application.routes.draw do
get '/(:locale)/products/(:category)/(page/:page).:extension',
:to => 'products#index',
:as => :products,
:constraints => {
:locale => /[a-z]{2}/,
:category => /.+?/,
:page => /\d+/
},
@skagedal
skagedal / underscore-pickrandom.js
Created Jan 31, 2012
pickRandom mixin for underscore
View underscore-pickrandom.js
// underscore-pickrandom.js
// (c) 2012 Simon Kågedal Reimer
// This file is freely distributable under the MIT license.
// _.pickRandom - a mixin for underscore.js.
//
// Pick random elements from an array. Works similar to
// `_.first(_.shuffle(array, n))`, but is more efficient -- operates
// in time proportional to `n` rather than the length of the whole
// array.
@tancnle
tancnle / gist:2969692
Created Jun 22, 2012
Fix incorrect Nokogiri loaded libraries
View gist:2969692

Every time I upgrade libxml2 via Homebrew, running cucumber test will post an annoying warning message

WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.8.0

To fix it:

$ gem uninstall nokogiri
$ brew link libxml2
$ gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.8.0/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.8.0/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26
@alvinlai
alvinlai / .gitignore
Created Jul 1, 2012 — forked from mybuddymichael/.gitignore
Starter Stasis project
View .gitignore
/.sass-cache
/public
@ElliotChong
ElliotChong / pixi-graphics-additions.coffee
Last active Dec 20, 2015
Adds drawArc, drawRoundRect, and drawSlice methods to Pixi.js's Graphics object.
View pixi-graphics-additions.coffee
toRad = (p_angle) ->
return (p_angle - 90) * Math.PI / 180
for method in ["drawArc", "drawRoundRect", "drawSlice"]
if PIXI.Graphics.prototype[method]? then console.warn "PixiJS already has an #{method} method defined. It's recommended that you update your code to use the official implementation."
PIXI.Graphics.prototype.drawArc = (p_x, p_y, p_radius, p_startAngle, p_endAngle) ->
totalAngle = p_endAngle - p_startAngle
segments = Math.ceil Math.abs(Math.sqrt(1 - Math.pow (1 - Math.min(p_radius / 60, 1)), 2) * totalAngle * p_radius * 0.01)
anglePerSegment = totalAngle / segments
@iwasrobbed
iwasrobbed / gist:1032395
Created Jun 17, 2011
Amazon S3 Query String Authentication for Ruby on Rails
View gist:1032395
def generate_secure_s3_url(s3_key)
#
# s3_key would be a path (including filename) to the file like: "folder/subfolder/filename.jpg"
# but it should NOT contain the bucket name or a leading forward-slash
#
# this was built using these instructions:
# http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?S3_QSAuth.html
# http://aws.amazon.com/code/199?_encoding=UTF8&jiveRedirect=1
s3_base_url = MyApp::Application::S3_BASE_URL # i.e. https://mybucket.s3.amazonaws.com
@tvandervossen
tvandervossen / gist:1231476
Created Sep 21, 2011
Mobile Safari viewport sizes on iOS 4.3 and 5
View gist:1231476
iPad
1024 × 690 In landscape on iOS 4.3
1024 × 672 In landscape on iOS 5
768 × 946 In portrait on iOS 4.3
768 × 928 In portrait on iOS 5
1024 × 660 Always showing bookmarks bar in landscape on iOS 4.3
1024 × 644 Always showing bookmarks bar in landscape on iOS 5
768 × 916 Always showing bookmarks bar in portrait on iOS 4.3
@chriseppstein
chriseppstein / 1_slower_sprite_file.scss
Created Dec 20, 2010
This gist demonstrates how a generated sprite file can be optimized to shave some time off your compile.
View 1_slower_sprite_file.scss
@import "compass/utilities/sprites/base";
// General Sprite Defaults
// You can override them before you import this file.
$emblem-sprite-base-class: ".emblem-sprite" !default;
$emblem-sprite-dimensions: false !default;
$emblem-position: 0% !default;
$emblem-spacing: 0 !default;
$emblem-repeat: no-repeat !default;
@victorb
victorb / gist:4181764
Last active May 7, 2017 — forked from davatron5000/gist:2254924
Static Site Generators
View gist:4181764

This is an updated fork of the gist located here: https://gist.github.com/2254924

Backstory: I decided to crowdsource static site generator recommendations, so the following are actual real world suggested-to-me results. I then took those and sorted them by language/server and, just for a decent relative metric, their Github Watcher count. If you want a heap of other projects (including other languages like Haskell and Python) Nanoc has the mother of all site generator lists. If you recommend another one, by all means add a comment.

Ruby

You can’t perform that action at this time.