Skip to content

Instantly share code, notes, and snippets.

View georgiee's full-sized avatar
👻
Ghosting github.com since a while

Georgios Kaleadis georgiee

👻
Ghosting github.com since a while
View GitHub Profile
@skagedal
skagedal / underscore-pickrandom.js
Created January 31, 2012 11:22
pickRandom mixin for underscore
// 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 June 22, 2012 01:32
Fix incorrect Nokogiri loaded libraries

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 July 1, 2012 04:56 — forked from mybuddymichael/.gitignore
Starter Stasis project
/.sass-cache
/public
@ElliotChong
ElliotChong / pixi-graphics-additions.coffee
Last active December 20, 2015 02:59
Adds drawArc, drawRoundRect, and drawSlice methods to Pixi.js's Graphics object.
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 June 17, 2011 21:29
Amazon S3 Query String Authentication for Ruby on Rails
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
@victorb
victorb / gist:4181764
Last active May 7, 2017 10:09 — forked from davatron5000/gist:2254924
Static Site Generators

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

@dfadler
dfadler / get-sprite.sass
Created July 13, 2012 15:05
A SASS mixin for generating a sprite declaration block that will work with media queries
// http://compass-style.org/reference/compass/helpers/sprites/
@mixin get-sprite($map, $sprite, $repeat: no-repeat, $height: true, $width: true)
//http://compass-style.org/reference/compass/helpers/sprites/#sprite-file
$sprite-image: sprite-file($map, $sprite)
// http://compass-style.org/reference/compass/helpers/sprites/#sprite-url
$sprite-map: sprite-url($map)
// http://compass-style.org/reference/compass/helpers/sprites/#sprite-position
@mxriverlynn
mxriverlynn / 1.html
Created April 11, 2012 14:37
modal dialog with backbone
<script id="modal-view-template" type="text/html">
<div class="modal-header">
<h2>This is a modal!</h2>
</div>
<div class="modal-body">
<p>With some content in it!</p>
</div>
<div class="modal-footer">
<button class="btn">cancel</button>
<button class="btn-default">Ok</button>
@jamiew
jamiew / unicorn.rb
Created October 14, 2010 17:58 — forked from jimmysoho/gist:534668
Unicorn config for use with bundler and capistrano - fixes issues with environment pollution.rb
# My pimped out unicorn config, with incremental killof
# and all the latest capistrano & bundler-proofing
# @jamiew :: http://github.com/jamiew
application = "000000book.com"
environment = ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'production'
app_path = "/srv/#{application}"
bundle_path = "#{app_path}/shared/bundle"
timeout 30