Skip to content

Instantly share code, notes, and snippets.

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

@ricardobeat
ricardobeat / semaphore.js
Created March 3, 2011 01:30
simple semaphore for parallel async execution, with error handling.
function queue(name){
queue.q[name]++ || (queue.q[name] = 1);
return function(err){
if (err && queue.e[name]) queue.e[name](err);
else if (err) throw err;
process.nextTick(function(){
queue.q[name]--;
queue.check(name);
});
}
@kof
kof / inherits.js
Created March 24, 2011 13:10
nodejs like utility method for inheritance
/**
* Inherit prototype properties
* @param {Function} ctor
* @param {Function} superCtor
*/
_.mixin({
inherits: (function(){
function noop(){}
function ecma3(ctor, superCtor) {
@hmert
hmert / jquery-profile.js
Created January 1, 2012 06:53
jQuery Profiling Plugin
/*
* http://ejohn.org/blog/deep-profiling-jquery-apps/
* use: call jQuery.displayProfile(); in firebug console
*/
(function(){var log=[];var handle=jQuery.event.handle,ready=jQuery.ready;var internal=false;var eventStack=[];var curEvent=log[0]={event:"inline",methods:[],duration:0};if(!jQuery.readyList)jQuery.readyList=[];jQuery.readyList.unshift(function(){if(curEvent&&curEvent.event=="inline"&&curEvent.methods.length==0){log.shift()}if(curEvent)eventStack.push(curEvent);var e=curEvent=log[log.length]={event:"ready",target:formatElem(document),methods:[]};var start=(new Date).getTime();jQuery(document).bind("ready",function(){e.duration=(new Date).getTime()-start;curEvent=eventStack.pop()})});jQuery.event.handle=function(event){var pos=log.length;if(curEvent)eventStack.push(curEvent);var e=curEvent=log[pos]={event:event.type,target:formatElem(event.target),methods:[]};var start=(new Date).getTime();var ret=handle.apply(this,arguments);e.duration=(new Date).getTime()-start;curEvent=eventStack.pop();if(e.me
@k3n
k3n / lint-all-files-recursive.php
Created February 16, 2012 16:26
Applies PHP's lint check to all PHP files in a directory.
<?php
/**
* Recurses each directory and runs PHP's lint function against each file
* to test for parse errors.
*
* @param string $dir the directory you would like to start from
* @return array the files that did not pass the test
*/
function lint( $dir = 'C:\dev\\' )
@magnetik
magnetik / php-cli.php
Created June 20, 2012 12:14
Php command line parser
function parseArguments()
{
array_shift($argv);
$out = array();
foreach($argv as $arg)
{
if(substr($arg, 0, 2) == '--')
{
$eqPos = strpos($arg, '=');
if($eqPos === false)
@P4
P4 / default.reg
Last active April 13, 2024 05:23
Color schemes for Windows Command Prompt
Windows Registry Editor Version 5.00
; Default color scheme
; for Windows command prompt.
; Values stored as 00-BB-GG-RR
[HKEY_CURRENT_USER\Console]
; BLACK DGRAY
"ColorTable00"=dword:00000000
"ColorTable08"=dword:00808080
; BLUE LBLUE
@svenax
svenax / natchars.ahk
Last active December 11, 2015 21:28
National character key chords for use with AutoHotkey (http://www.autohotkey.com)
; -*- st-default_line_ending: windows -*-
; National characters ========================================================
#Hotstring * ? ; Expand immediately everywhere
::,aa::á
::,ae::æ
::,ag::à
::,cc::ç
::,ee::é
@james2doyle
james2doyle / render-php-file.php
Last active April 4, 2024 15:33
A function to render a php file with data. Allows templating and then sending an array of data into the view.
<?php
function renderPhpFile($filename, $vars = null) {
if (is_array($vars) && !empty($vars)) {
extract($vars);
}
ob_start();
include $filename;
return ob_get_clean();
}
@mvmaasakkers
mvmaasakkers / gist:7335471
Last active December 27, 2015 13:48
Fix for content-disposition issues on multipart forms via php://input (for instance PUT requests)
<?php
function getPostfieldsFromInput() {
$ct = $_SERVER['CONTENT_TYPE'];
$position = stripos($ct, "multipart/form-data;");
$input = file_get_contents("php://input");
$postVars = array();
if($position !== false) {
$exp = explode("boundary=", $ct);