Skip to content

Instantly share code, notes, and snippets.

View couto's full-sized avatar
👽
Did you raid area 51?

Luís Couto couto

👽
Did you raid area 51?
View GitHub Profile
@harthur
harthur / snippet.md
Created June 18, 2012 22:12
console.log() key binding for Sublime Text

Go to Sublime Text 2 > Preferences > Key Bindings - User and add this JSON to the file:

[
    { "keys": ["super+shift+l"],
      "command": "insert_snippet",
      "args": {
        "contents": "console.log(${1:}$SELECTION);${0}"
      }
 }
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 14, 2025 04:09
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@hopsoft
hopsoft / readme2ghpage.rb
Created June 21, 2012 17:09
Convert your README.md on master to index.md on gh-pages
#!/usr/bin/env ruby
# checkout the readme from the master branch
`git checkout gh-pages; git checkout master README.md`
path = `pwd`.gsub(/\n/, "")
readme_path = File.join(path, "README.md")
index_path = File.join(path, "index.md")
# write the index readme file
@drudge
drudge / init.pp
Created June 25, 2012 17:17
Node.js Puppet Module
class nodejs ( $version, $logoutput = 'on_failure' ) {
$nave_path = '/usr/local/bin/nave'
$nave_dir = '/usr/local/lib/nave'
package { 'bash':
ensure => present,
}
package { 'curl':
ensure => present,
@domenic
domenic / 1-index.html
Last active October 7, 2015 05:27
Proof of concept of ES5 data binding
<!DOCTYPE html>
<html>
<head>
<title>ES5 Data Binding Proof of Concept</title>
</head>
<body>
<section>
<label>
Name:
<input data-bind="name" type="text" />
@gnclmorais
gnclmorais / statusCodes.js
Created July 20, 2012 20:26
HTTP Statuses Codes for JavaScript
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Inspired by Filipe Kiss' protip (http://coderwall.com/p/o2hpka), *
* I decided to port his PHP variable to JavaScript. *
* Do whatever you want with this. Enjoy. Full credit to Filipe. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
var status = {
100: 'HTTP/1.1 100 Continue',
101: 'HTTP/1.1 101 Switching Protocols',
@jedp
jedp / example.js
Created August 1, 2012 20:45
Node.JS CouchDB paginator
var cradle = require('cradle');
// change as necessary
var host = '127.0.0.1';
var port = 5984;
var dbname = 'foo';
// setup cradle db and paginator
var conn = new (cradle.Connection)(host, port);
var db = conn.database(dbname);
@johntyree
johntyree / getBlockLists.sh
Last active June 4, 2025 15:24
Make one large blocklist from the bluetack lists on iblocklist.com
#!/usr/bin/env sh
# Download lists, unpack and filter, write to stdout
curl -s https://www.iblocklist.com/lists.php \
| sed -n "s/.*value='\(http:.*=bt_.*\)'.*/\1/p" \
| xargs wget -O - \
| gunzip \
| egrep -v '^#'
@jameswomack
jameswomack / javascript_background_thread.js
Created September 11, 2012 06:41
Extend function prototype to run a function as a WebWorker
Function.prototype.runOnBackgroundThread = function (aCallback) {
var _blob = new Blob(['onmessage = '+this.toString()],{"type":"text/javascript"});
var _worker = new Worker((webkitURL.createObjectURL || URL.createObjectURL)(_blob));
_worker.onmessage = aCallback;
_worker.postMessage();
}
var _test = function () {
postMessage((1+1).toString());
}
@nikic
nikic / password_hashing_api.md
Created September 12, 2012 15:04
The new Secure Password Hashing API in PHP 5.5

The new Secure Password Hashing API in PHP 5.5

The [RFC for a new simple to use password hashing API][rfc] has just been accepted for PHP 5.5. As the RFC itself is rather technical and most of the sample codes are something you should not use, I want to give a very quick overview of the new API:

Why do we need a new API?

Everybody knows that you should be hashing their passwords using bcrypt, but still a surprising number of developers uses insecure md5 or sha1 hashes (just look at the recent password leaks). One of the reasons for this is that the crypt() API is ridiculously hard to use and very prone to programming mistakes.