Skip to content

Instantly share code, notes, and snippets.

View blvz's full-sized avatar

Rafael Belvederese blvz

View GitHub Profile
// Released under MIT license: http://www.opensource.org/licenses/mit-license.php
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);
@tekacs
tekacs / show
Created April 20, 2011 17:55
This does something essentially equivalent to showoff.io if you have a publicly facing server...
# Usage: show <local-port> <subdomain>
function show() {
DOMAIN=".tekacs.com"
REMOTE="$2$DOMAIN"
ssh -tR 1080:127.0.0.1:$1 vps "sudo ssh -Nl \$USER -L $REMOTE:80:127.0.0.1:1080 localhost"
}
@bjnsn
bjnsn / EncodePath.js
Created August 23, 2012 19:03
Encode a path into compact EaselJS format using EaselJS/Canvas path commands
/**
* The reverse of the EaselJS Graphics.decode method for
* compactly encoding paths.
*
* @author Brett Johnson, periscopic.com
*
* @example
* var ep = new EncodePath();
* ep.moveTo(-150, 0).lineTo(150, 0);
* var shp = new Shape();
alias fixow='/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain user;killall Finder;echo "Open With has been rebuilt, Finder will relaunch"'
@igstan
igstan / option.js
Last active December 18, 2015 05:49
// `unit` is `return` from Haskell
// `bind` is `>>=` from Haskell, or `flatMap` from Scala
var None = {
bind: function (fn) { return this; },
unit: function (v) { return Option(v); },
getOrElse: function (elseValue) { return elseValue; }
};
var Some = function (value) {
@vicro
vicro / gist:5829162
Last active February 16, 2024 07:23
Retina Display for CreateJS
var canvas, stage, exportRoot;
function init() {
canvas = document.getElementById("canvas");
//Setup the canvas widht and height with devicePixelRatio. And set CSS width and height properties.
var w = 320;
var h = 357;
canvas.width = w * window.devicePixelRatio;
canvas.height = h * window.devicePixelRatio;
@nikmartin
nikmartin / A: Secure Sessions Howto
Last active April 7, 2024 21:56
Secure sessions with Node.js, Express.js, and NginX as an SSL Proxy
Secure sessions are easy, but not very well documented.
Here's a recipe for secure sessions in Node.js when NginX is used as an SSL proxy:
The desired configuration for using NginX as an SSL proxy is to offload SSL processing
and to put a hardened web server in front of your Node.js application, like:
[NODE.JS APP] <- HTTP -> [NginX] <- HTTPS -> [PUBLIC INTERNET] <-> [CLIENT]
Edit for express 4.X and >: Express no longer uses Connect as its middleware framework, it implements its own now.
@John07
John07 / HLS_dvr.sh
Last active June 10, 2023 10:40
A small script to make recording http live streams (HLS, those streams that work on iOS devices) nicer on a Mac. Script records the stream for a defined period of time and sends the user notifications if anything goes wrong and once it's done.
# required: ffmpeg (e.g. from homebrew), terminal-notifier from https://github.com/alloy/terminal-notifier
# you can schedule this with launchd to run e.g. weekly
# Specify in seconds how long the script should record (default here is 1 hour).
seconds=3600
# Date format for the recording file name
DATE=`date "+%d-%m-%y_%H-%M"`
# start ffmpeg recording
@archan937
archan937 / Rakefile
Created January 8, 2014 10:49
Override Rake::Task.define_task for cleaner arguments passing
require_relative "task"
desc "Send an invite"
task :invite do |name, email|
puts "Invitation sent to '#{name} <#{email}>'"
end
# Example:
#
# $ rake invite "Paul Engel" paul@engel.com
@wbroek
wbroek / genymotionwithplay.txt
Last active February 12, 2024 03:22
Genymotion with Google Play Services for ARM
NOTE: Easier way is the X86 way, described on https://www.genymotion.com/help/desktop/faq/#google-play-services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)