Skip to content

Instantly share code, notes, and snippets.

@victorstanciu
victorstanciu / .bashrc
Created January 24, 2013 15:28
Show octal permissions in ls output
alias lo="ls -lha --color=always -F --group-directories-first | awk '{k=0;for(i=0;i<=8;i++)k+=((substr(\$1,i+2,1)~/[rwx]/)*2^(8-i));if(k)printf(\"%0o \",k);print}'"
define(function () {
var Bracket = function (element, manager) {
this.element = element;
this.manager = manager;
this.id = parseInt(element.getAttribute('data-id')); // don't rely on this to be unique until a sync() is made
this.round = parseInt(element.getAttribute('data-round'));
this.rounds = parseInt(element.getAttribute('data-rounds'));
this.order = parseInt(element.getAttribute('data-order'));
@victorstanciu
victorstanciu / gist:4275483
Created December 13, 2012 10:16
Sublime Text 2 PHP build system
{
"cmd": ["php", "-f", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.php"
}
@victorstanciu
victorstanciu / gist:4275478
Created December 13, 2012 10:15
Sublime Text 2 JS build system
{
"cmd": ["node", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.js"
}
/\@auth (?<model>[a-z0-9_]+)\s?(?<return>[a-z0-9-\.]+)?(\r\n|\r|\n)/i
#!/bin/bash
svn add `svn status .|grep "^?"|awk '{print $2}'`
@victorstanciu
victorstanciu / sample.html
Created November 26, 2012 14:15
Sample document file
<p>This is a test paragraph.</p>
<h3>This is 3rd level heading</h3>
<p>This is a test paragraph.</p>
<h4>This is 4th level heading</h4>
<p>This is a test paragraph.</p>
<h5>This is 5th level heading</h5>
<p>This is a test paragraph.</p>
<h6>This is 6th level heading</h6>
<p>This is a test paragraph.</p>
<h2>Basic block level elements</h2>
document.on('dom:loaded', function () {
var spies = $$('a[data-spy]');
var targets = [];
for (var i = 0; i < spies.length; i++) {
var target = $(spies[i].getAttribute('data-spy'));
target['data-spy'] = spies[i];
targets.push(target);
, process: function () {
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
, scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
, maxScroll = scrollHeight - this.$scrollElement.height()
, offsets = this.offsets
, targets = this.targets
, activeTarget = this.activeTarget
, i
if (scrollTop >= maxScroll) {
@victorstanciu
victorstanciu / common.js
Created October 15, 2012 14:28
Lazy load JS files
function load_script(src, callback) {
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = src;
script.onload = callback;
script.onreadystatechange = function() {
if (this.readyState == 'loaded' || this.readyState == 'complete') {