Skip to content

Instantly share code, notes, and snippets.

@defeated
defeated / users.yml
Created September 20, 2011 17:07
Devise User Fixture
one:
email: e@mail.com
encrypted_password: <%= User.new.send(:password_digest, "password") %>
authentication_token: <%= User.authentication_token %>
@jfriedlaender
jfriedlaender / gist:1273614
Created October 9, 2011 12:19
Lighten or darken a hexadecimal color (string)
# Amount should be a decimal between 0 and 1. Lower means darker
def darken_color(hex_color, amount=0.4)
hex_color = hex_color.gsub('#','')
rgb = hex_color.scan(/../).map {|color| color.hex}
rgb[0] = (rgb[0].to_i * amount).round
rgb[1] = (rgb[1].to_i * amount).round
rgb[2] = (rgb[2].to_i * amount).round
"#%02x%02x%02x" % rgb
end
@gsluthra
gsluthra / tree_html5.html
Created August 20, 2012 07:10
Fractal Tree Generation using HTML5 Canvas and Random Numbers
<html>
<head>
<script type="text/javascript">
window.onload = draw;
function draw(){
@wrburgess
wrburgess / gist:3778949
Created September 24, 2012 22:54
Setup wicked_pdf and wkhtmltopdf with Rails 3 and Heroku

Disclaimer: This post is Meteor & Backbone beef. Both Meteor and Backbone are absolute genius, and far beyond anything I could dream to create. But IMO there are better tools. Prepare yourselves *gulp*, I need to get this off my chest.

First, Backbone. Why people? It revolutionized JavaScript, did wonderful things for the world, and served its purpose well. But now we have better tools, so let’s move on. It’s like Gentoo users proselytizing Gentoo to the masses, perpetuating it as most common Distro; where all this time, Ubuntu would have saved everyone countless hours. Not

// Created by STRd6
// MIT License
// jquery.paste_image_reader.js
(function($) {
var defaults;
$.event.fix = (function(originalFix) {
return function(event) {
event = originalFix.apply(this, arguments);
if (event.type.indexOf('copy') === 0 || event.type.indexOf('paste') === 0) {
event.clipboardData = event.originalEvent.clipboardData;
@Doppp
Doppp / gist:5498969
Last active December 16, 2015 21:20
RailsConf 2013 Talks

Opening Keynote - dhh:

- Roger's Innovation Adoption Curve - Same for open source and normal products
- Nested Russian Doll Cache

How Shopify Scales Rails:

- Stack
	- Ruby 1.9.3-p385
	- Rails 3.2
	- Percona MySQL 5.5
  • Unicorn 4.5
@bigglesrocks
bigglesrocks / README.md
Last active February 24, 2023 05:51
Rails Scoped Invitation System

#Scoped Invitation System for User Groups with Rails#

Starting out with the following models and associations:

####User

  • has_many :memberships
  • has_many :organizations through :memberships

####Organization (User Group)

  • has_many :memberships
@mpetroff
mpetroff / index.html
Created March 28, 2015 02:29
Bootstrap Navbar without jQuery
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Navbar Template for Bootstrap</title>
@maxivak
maxivak / readme.md
Last active January 12, 2024 06:53
Integrating Gem/Engine and Main Rails App