Skip to content

Instantly share code, notes, and snippets.

View rafaelrinaldi's full-sized avatar

Rafael Rinaldi rafaelrinaldi

View GitHub Profile
@endolith
endolith / Has weird right-to-left characters.txt
Last active April 30, 2024 12:48
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@eligrey
eligrey / object-watch.js
Created April 30, 2010 01:38
object.watch polyfill in ES5
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@tobitailor
tobitailor / get_barcode_from_image.js
Created June 1, 2010 19:33
Barcode recognition with JavaScript - Demo: http://bit.ly/djvUoy
/*
* Copyright (c) 2010 Tobias Schneider
* This script is freely distributable under the terms of the MIT license.
*/
(function(){
var UPC_SET = {
"3211": '0',
"2221": '1',
"2122": '2',
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@HashNuke
HashNuke / gist:608259
Created October 3, 2010 04:13
to undo push and commits
# to undo a git push
git push -f origin HEAD^:master
# to get to previous commit (preserves working tree)
git reset --soft HEAD
# to get back to previous commit (you'll lose working tree)
git reset --hard HEAD^
// the old, lame way
protected var _property:Property;
public function get property():Property
{
if (!_property)
{
_property = new Property();
}

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@millermedeiros
millermedeiros / gist:837780
Created February 21, 2011 22:02
Simple Sorted Insertion
/**
* Add items to Array in a sorted order.
* @param {Array} arr
* @param {Number} item
* @author Miller Medeiros
* Released under the WTFPL (http://sam.zoy.org/wtfpl/)
*/
function sortedInsert(arr, item){
var n = arr.length;
do { n--; } while (item < arr[n]);
@millermedeiros
millermedeiros / gist:870867
Created March 15, 2011 15:18
JavaScript Chaining Example
//
// Orthodox Chaining
//
//basic Object that implements chaining
var myObj = {
_val : 'lorem',
val : function(val){
if(val === void(0)){
return this._val;
@fefranca
fefranca / wallpaperize.sh
Created April 15, 2011 14:58
Convert all jpgs in the current directory to their own individual zips
#!/bin/sh
# Convert all jpgs in the current directory to their own individual zips
for f in `ls *.jpg`; do
z=`echo $f | grep -Eo '(.+)\.'`zip;
echo $'\e[32m' "$f -> $z" $'\e[0m'
zip $z $f
done