Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

/*!
* jQuery TextChange Plugin
* http://www.zurb.com/playground/jquery-text-change-custom-event
*
* Copyright 2010, ZURB
* Released under the MIT License
*/
(function ($) {
$.event.special.textchange = {
@them0nk
them0nk / rspec_rails_cheetsheet.rb
Created March 23, 2012 03:39
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@briandoll
briandoll / A_toast_to_you.md
Last active March 19, 2022 01:17
Toasts! - scripts to convert images attached to GitHub issues into an animated gif for serious celebratory purposes

To toast:

  • Make sure you have ImageMagick installed (brew install imagemagick)
  • Change line 7 of toast.rb to the repository name you're working with
  • toast!
$ bundle install
$ ./get_token [user] [pass]
$ export GHUSER=[myuser]
@aienn
aienn / bydloscript.rb
Created March 11, 2013 22:23
CMeLLIHa9l_KupuJIJIuLLa_no3BoHuT!
#usage ruby bydloscript.rb Здесь смешные надписи кириллицей лол!
source = ARGV.join(" ").strip.split(//)
table = { "а" => "a", "А" => "A",
"б" => "6", "Б" => "6",
"в" => "B", "В" => "B",
"г" => "r", "Г" => "r",
"д" => "D", "Д" => "D",
"е" => "e", "Е" => "E",
"ё" => "e", "Ё" => "E",
@sxua
sxua / UIAppearance.md
Created September 18, 2013 17:19
UIAppearance methods (including iOS 7)

UIActivityIndicatorView

5.0

@property (readwrite, nonatomic, retain) UIColor *color

UIBarButtonItem

@chengyin
chengyin / linkedout.js
Last active July 11, 2021 15:23
Unsubscribe all LinkedIn email in "one click". For an easier to use version, you can check out the bookmarklet: http://chengyin.github.io/linkedin-unsubscribed/
// 1. Go to page https://www.linkedin.com/settings/email-frequency
// 2. You may need to login
// 3. Open JS console
// ([How to?](http://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers))
// 4. Copy the following code in and execute
// 5. No more emails
//
// Bookmarklet version:
// http://chengyin.github.io/linkedin-unsubscribed/
Ruby 2.1.0 in Production: known bugs and patches
Last week, we upgraded the github.com rails app to ruby 2.1.0 in production.
While testing the new build for rollout, we ran into a number of bugs. Most of
these have been fixed on trunk already, but I've documented them below to help
anyone else who might be testing ruby 2.1 in production.
@naruse I think we should backport these patches to the ruby_2_1 branch and
release 2.1.1 sooner rather than later, as some of the bugs are quite critical.
I'm happy to offer any assistance I can to expedite this process.
@hubert3
hubert3 / samsung_hash_crack.py
Last active November 22, 2022 09:12
Python implementation of passcode hashing algorithm used on the Samsung Galaxy S4 GT-I9505 4.2.2
#!/usr/bin/python
'''
Python implementation of passcode hashing algorithm used on the Samsung Galaxy S4 GT-I9505 4.2.2
Correct PIN for hash and salt below is 1234.
Get 40-character hash value in ascii hex format from file /data/system/password.key on the phone
Get salt in signed numeric format by doing sqlite3 query SELECT value FROM locksettings WHERE name = 'lockscreen.password_salt' on /data/system/locksettings.db
@knyar
knyar / statsd.lua
Created February 9, 2014 19:59
statsd interface for nginx (via ngx_lua)
-- ----------------------------------------------------------------------------
-- statsd interface for nginx
-- (c) 2014 Anton Tolchanov
-- https://gist.github.com/knyar/8905045
--
-- Usage:
-- 1. install nginx with ngx_lua;
-- 2. put this file as statsd.lua somewhere (/var/lib/nginx/lua/ will do);
-- 3. initialize stats in init_by_lua:
-- http {
@tiegz
tiegz / object_profiler.rb
Last active August 29, 2015 14:03
Object Profiler for ruby 2.1.0+
module ObjectSpace
def self.profile(&blk)
require 'objspace'
enable_gc = GC.disable
ObjectSpace.trace_object_allocations(&blk)
objs = Hash.new(0)
ObjectSpace.each_object { |o|
if (file = ObjectSpace.allocation_sourcefile(o)) && (line = ObjectSpace.allocation_sourceline(o))
objs["#{file}:#{line}:#{o.class.name}"] += 1