Skip to content

Instantly share code, notes, and snippets.

@javiervidal
javiervidal / 0_reuse_code.js
Created February 23, 2017 15:47
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
# This prevents capistrano from hanging when executing long tasks
# /etc/ssh/sshd_config
TCPKeepAlive yes
ClientAliveInterval 15
ClientAliveCountMax 5
# Restart sshd
# If you post to a Ruby on Rails REST API endpoint, then you'll get an
# InvalidAuthenticityToken exception unless you set a different
# content type in the request headers, since any post from a form must
# contain an authenticity token.
#
# This example shows you how to post to a rails endpoint.
require 'json'
@javiervidal
javiervidal / canvasToFile.js
Created October 15, 2012 16:35 — forked from eamodeorubio/canvasToFile.js
Quick hack to save the contents of a canvas to a file in Windows 8 with JS
function saveToFile() {
var canvasData = document.getElementById('sampleCanvas').msToBlob();
var windowsStorage = Windows.Storage;
var inputStream, outputStream;
windowsStorage.KnownFolders.picturesLibrary.createFileAsync('sample.png', windowsStorage.CreationCollisionOption.replaceExisting)
.then(function (file) {
return file.openAsync(windowsStorage.FileAccessMode.readWrite);
}).then(function (out) {
inputStream = canvasData.msDetachStream();
canvasData.msClose();
@javiervidal
javiervidal / git_tips.md
Created December 20, 2010 10:40 — forked from fguillen/git_tips.md
Git tips

(Several of these git examples have been extracted from the book 'Pragmatic guide to GIT' of Travis Swicegood )

Git tips

Global git user

git config --global user.name "Fernando Guillen"
git config --global user.email "fguillen.mail+spam@gmail.com"

Repository git user

cd /develop/myrepo