Skip to content

Instantly share code, notes, and snippets.

View mig8447's full-sized avatar
🎯
Focusing

Miguel Sánchez Villafán mig8447

🎯
Focusing
  • Zapopan, Jalisco, México
View GitHub Profile
@mytrile
mytrile / add_pinned_tabs_chrome
Created January 2, 2010 21:45
Pinned tabs in Google Chrome
# Add pinned tabs in Google Chrome
# add as argument to Google Chrome : --pinned-tab-count=2 http://google.com/ http://www.google.com/reader/view/
# example: /opt/google/chrome/google-chrome %U --pinned-tab-count=2 http://google.com/ http://www.google.com/reader/view/
@jonleighton
jonleighton / base64ArrayBuffer.js
Last active June 19, 2024 13:39
Encode an ArrayBuffer as a base64 string
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then
// use window.btoa' step. According to my tests, this appears to be a faster approach:
// http://jsperf.com/encoding-xhr-image-data/5
/*
MIT LICENSE
Copyright 2011 Jon Leighton
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@mjtko
mjtko / handlebarsTemplateEngine.js
Created May 12, 2011 22:39
knockout template engine for handlebars.js
/*
Handlebars Template Engine for Knockout JavaScript library
*//*!
Copyright (c) 2011 Mark J. Titorenko
License: MIT (http://www.opensource.org/licenses/mit-license.php)
*/
ko.handlebarsTemplateEngine = function () {
// adapted from MooTools.Element
//
// This is necessary to allow us to easily deal with table
@chrisroos
chrisroos / gpg-import-and-export-instructions.md
Created September 9, 2011 10:49
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@kylefox
kylefox / liquid-mode.js
Created November 11, 2011 00:02
Liquid syntax highlighting for CodeMirror.
/*
This overlay provides a 'liquid' mode to the excellent CodeMirror editor (http://codemirror.net/).
Add something like this to your CSS:
.cm-liquid-tag {
color: #32273f;
background: #ead9ff;
}
.cm-liquid-variable {
@archan937
archan937 / inspector.js
Created March 2, 2012 22:16
Inspect Javascript objects similar to 'object.toSource()' within Mozilla. Used in IE6+, Safari, Firefox and Chrome.
function inspect(object) {
switch (typeof(object)) {
case "undefined":
return "undefined";
case "string":
return "\"" + object.replace(/\n/g, "\\n").replace(/\"/g, "\\\"") + "\"";
case "object":
if (object == null) {
return "null";
}
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@mikesmullin
mikesmullin / chromedriver.sh
Created May 8, 2012 16:08
easily install chromedriver on linux/osx
sudo apt-get install unzip;
wget -O /tmp/chromedriver.zip http://chromedriver.googlecode.com/files/chromedriver_linux64_19.0.1068.0.zip && sudo unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/;
@nateware
nateware / gist:3915757
Created October 19, 2012 01:27
Start Mac VNC server from command line
# Step 1: Set priveleges
$ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -allUsers -privs -all
Starting...
Setting allow all users to YES.
Setting all users privileges to 1073742079.
Done.
# Step 2: Allow VNC clients
@fgrehm
fgrehm / gist:4489503
Last active November 30, 2020 16:25
knockout.js + handlebars
class HandlebarsTemplateEngine extends ko.templateEngine
renderTemplateSource: (compiledTemplate, bindingContext, options) ->
data = bindingContext.$data
htmlResult = compiledTemplate(data)
ko.utils.parseHtmlFragment(htmlResult)
makeTemplateSource: (template, templateDocument) ->
throw "Could not find a template named: '#{template}'" unless JST[template]
JST[template]