Skip to content

Instantly share code, notes, and snippets.

View cr0t's full-sized avatar
🏠
Working from home

Sergey Kuznetsov cr0t

🏠
Working from home
View GitHub Profile
@defunkt
defunkt / clients.md
Created April 18, 2010 14:09
A list of Gist clients.

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

@jpantuso
jpantuso / osx_lion_rail_setup.md
Created July 27, 2011 19:51
Setup OS X 10.7 w/ homebrew, oh-my-zsh, rvm, rails, and MySQL
@cr0t
cr0t / gist:1826732
Created February 14, 2012 13:24
unicorn.rb config file
APP_PATH = "/var/www/tld.appname"
rails_env = ENV["RAILS_ENV"] || "development"
# 2 workers and 1 master
worker_processes 2
working_directory APP_PATH + "/current" # available in 0.94.0+
# Load rails+github.git into the master before forking workers
@cr0t
cr0t / gist:1826746
Created February 14, 2012 13:26
unicorn init script
#!/bin/sh
# we assume that we use system wide rvm installation (in /usr/local/rvm)
# and our application is deployed to /var/www/tld.appname directory
RVM_ENV="ruby-1.9.3-p0@gemset"
APP_DIR="tld.appname"
# load rvm
source /usr/local/rvm/environments/$RVM_ENV
@masak
masak / explanation.md
Last active June 18, 2024 08:24
How is git commit sha1 formed

Ok, I geeked out, and this is probably more information than you need. But it completely answers the question. Sorry. ☺

Locally, I'm at this commit:

$ git show
commit d6cd1e2bd19e03a81132a23b2025920577f84e37
Author: jnthn <jnthn@jnthn.net>
Date:   Sun Apr 15 16:35:03 2012 +0200

When I added FIRST/NEXT/LAST, it was idiomatic but not quite so fast. This makes it faster. Another little bit of masak++'s program.

@norman
norman / character_reference.rb
Last active September 9, 2021 20:48
HTML entities? We don't need no stinkin' HTML entities.
# coding: utf-8
#
# Encode any codepoint outside the ASCII printable range to an HTML character
# reference (https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_reference_overview).
def encode(string)
string.each_codepoint.inject("") do |buffer, cp|
cp = "&#x#{cp.to_s(16)};" unless cp >= 0x20 && cp <= 0x7E
buffer << cp
end
end
@german
german / active_record_introspection.rb
Created May 29, 2012 13:37
adding introspection to all ActiveRecord methods (putting method's name when it's invoked)
module ActiveRecord
Base.singleton_methods.each do |m|
Base.class_eval <<-EOS
class << self
puts "redefining #{m}"
define_method "#{m}_with_introspection" do |*args|
puts "#{m}"
send(:"#{m}_without_introspection", *args)
end
@xdite
xdite / gist:3106785
Created July 13, 2012 19:15
Speedup Rails Asset Pipeline precompile process
@kossnocorp
kossnocorp / base_view.js.coffee
Created December 21, 2012 19:00
Classical JS pitfall
class Amplifr.BaseView extends Backbone.View
constructor: ->
@createSelectors()
super
els: {}
createSelectors: ->
for name, selector of @els
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active July 7, 2024 19:32
A badass list of frontend development resources I collected over time.