Skip to content

Instantly share code, notes, and snippets.

View twokul's full-sized avatar
😎
mischief, mostly.

Alex Navasardyan twokul

😎
mischief, mostly.
View GitHub Profile
@twokul
twokul / ex1.php
Created August 12, 2012 15:23 — forked from getify/ex1.php
exploring inline decision-logic in templates
<!-- here's the PHP'ish way of making inline decisions while constructing HTML markup -->
<select name="foobar">
<option value="bam" <?=($foobar==="bam"?"selected":"")?>>Bam</option>
<option value="baz" <?=($foobar==="baz"?"selected":"")?>>Baz</option>
</select>
<input type="radio" name="foobar" value="bam" <?=($foobar==="bam"?"checked":"")?>> Bam
<input type="radio" name="foobar" value="baz" <?=($foobar==="baz"?"checked":"")?>> Baz
@twokul
twokul / it.sublime-snippet
Created August 24, 2012 13:49
jasmine-it-snippet
<snippet>
<content><![CDATA[
it("${1}", function () {
${2}
});
]]></content>
<tabTrigger>it</tabTrigger>
</snippet>
@twokul
twokul / describe.sublime-snippet
Created August 24, 2012 13:49
jasmine-describe-snippet
<snippet>
<content><![CDATA[
describe("${1}", function () {
${2}
});
]]></content>
<tabTrigger>desc</tabTrigger>
</snippet>
@twokul
twokul / requirejs-define.sublime-snippet
Created August 25, 2012 20:44
requirejs-define-sublime-snippet
<snippet>
<content><![CDATA[
define([
"${1}"
],
function (${2}) {
${3}
});]]></content>
<tabTrigger>define</tabTrigger>
</snippet>
@twokul
twokul / return-this.sublime-snippet
Created August 31, 2012 15:55
return-this-sublime-snippet
<snippet>
<content><![CDATA[
return this;
]]></content>
<tabTrigger>rt</tabTrigger>
</snippet>
@twokul
twokul / git-loglive
Created November 3, 2012 02:03 — forked from tlberglund/git-loglive
Log Live Git Command
#!/bin/bash
while :
do
clear
git --no-pager log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --all
sleep 1
done
@twokul
twokul / gist:4005504
Created November 3, 2012 02:04 — forked from tlberglund/gist:3208768
Live Log Script
#!/bin/bash
while :
do
clear
git --no-pager log -$1 --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
sleep 1
done
var i = 0,
arr = [1, 2, 3, 4, 5],
k = 46;
console.log(k);
for (i = 0, l = k; i < l; i++) {
console.log(i);
}
for (i = 0, l = arr.length; i < l; i++) {
@twokul
twokul / livewatch
Created November 12, 2012 11:22
live directory watcher
while; do; clear; tree .git; sleep 1; done
$.when($.ready.promise(), collection.fetch({
'silent': true
})).then(function () {
// Collection retrieved and the DOM is ready...
}, function () {
// Error handling; retrieval failed...
});