Skip to content

Instantly share code, notes, and snippets.

@moudy
moudy / transparent-gif.html
Created October 18, 2013 19:18
Base64 Encode of 1x1px Transparent GIF
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7">
@moudy
moudy / PomTaskView+Constraints.m
Last active December 22, 2015 18:49
Constraints category
#import "PomTaskView+Constraints.h"
@implementation PomTaskView (Constraints)
- (void)updateConstraints {
[super updateConstraints];
NSMutableArray *constraints = [NSMutableArray new];
NSDictionary *views = [self subviewsDictionary];
// want to uses this module like:
// `var $ = require('jquery');`
//
// so it incudes all plugins
var jquery = require('actual-jquery');
require('plugin.jquery');
module.exports = jquery;
{
"ease": [0.25, 0.1, 0.25, 1.0],
"linear": [0.00, 0.0, 1.00, 1.0],
"ease-in": [0.42, 0.0, 1.00, 1.0],
"ease-out": [0.00, 0.0, 0.58, 1.0],
"ease-in-out": [0.42, 0.0, 0.58, 1.0]
}
# Detect unsuppoerted browsers exculding crawlers and chrome frame
# browser gem - https://github.com/fnando/browser
def is_unsupported_browser?
is_ie = browser.ie6? || browser.ie7? || browser.ie8?
is_firefox36 = browser.firefox? && browser.full_version.match(/^3.6.*/)
is_crawler = request.env["HTTP_USER_AGENT"].match(/\(.*https?:\/\/.*\)/) if request.env["HTTP_USER_AGENT"]
has_chrome_frame = request.env["HTTP_USER_AGENT"].match(/chromeframe/) if request.env["HTTP_USER_AGENT"]
return !has_chrome_frame && (is_ie || is_firefox36) unless is_crawler
@moudy
moudy / flv-to-mp3
Last active December 14, 2015 21:59
ffmpeg -i moviet.flv -f mp3 sound.mp3
@moudy
moudy / jayz
Created February 15, 2013 17:08
#!/bin/bash
# play jay-z
jayz() {
osascript <<-EOF
tell application "iTunes" to play track 1 of playlist "Jay-Z"
EOF
}
@moudy
moudy / .pryrc
Created February 11, 2013 20:11
# load rails or RACK app if runnning pry in a project
if Dir.exists? './config'
current_app = './config/application.rb' if File.exists? './config/application.rb'
current_app = './config/environment.rb' if File.exists? './config/environment.rb'
require current_app if current_app
end
if defined? Rails && Rails.version[0..0] == "3"
require 'rails/console/app'
require 'rails/console/helpers'
function () {
return Backbone.View.prototype.render(this, arguments);
return Backbone.View.prototype.render(this, Array.prototype.slice.call(arguments));
}
@moudy
moudy / downloading multiple files with curl
Created April 10, 2011 18:46
download sequentially numbered files, specified using brackets [01-20] and rename them
curl http://www.cl.cam.ac.uk/~rja14/Papers/SE-[01-10].pdf -o renamed_file_#1.pdf