This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function () { | |
// add custom method | |
$.yafov.addMethod('[type="tel"]', 'telfoobar', function (value, element, cb) { | |
// imagine that this is an ajax call, and the function is the callback | |
setTimeout(function () { | |
var isValid = value !== '123'; | |
cb(isValid); | |
}, 1000); | |
}); | |
$.yafov.setMessage('telfoobar', 'value shouldn\'t be 123'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Foo = function () {}; | |
exports.Foo = Foo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var morse = (function () { | |
var charCodes = { | |
a: ".-", | |
b: "-...", | |
c: "-.-.", | |
d: "-..", | |
e: ".", | |
f: "..-.", | |
g: "--.", | |
h: "....", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
list-ticket = "!f() { branch=\"${2+}${2-`git name-rev --name-only HEAD`}\"; git rev-list --oneline --reverse --grep \"$1\" $branch; }; f" | |
pick-ticket = "!f() { branch=\"${2+}${2-`git name-rev --name-only HEAD`}\"; git rev-list --reverse --grep \"$1\" $branch | git cherry-pick --stdin; }; f" | |
pick-ticket-no-commit = "!f() { branch=\"${2+}${2-`git name-rev --name-only HEAD`}\"; git rev-list --reverse --grep \"$1\" $branch | git cherry-pick -n --stdin; }; f" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
maxcapcity=$(awk '/design capacity:/ {print $3}' /proc/acpi/battery/BAT0/info); | |
remainingcapacity=$(awk '/remaining capacity:/ {print $3}' /proc/acpi/battery/BAT0/state); | |
chargingstate=$(awk '/charging state:/ {print $3}' /proc/acpi/battery/BAT0/state) | |
used=$(($maxcapcity - $remainingcapacity)); | |
warnperc=0.1; | |
if [ "$chargingstate" = "charging" ]; | |
then | |
exit 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- 0 2012-03-31 14:49:23.913555005 +0200 | |
+++ 1 2012-03-31 14:49:20.432554976 +0200 | |
@@ -1,4 +1,5 @@ | |
-[Adblock] | |
-! Checksum: V+CY2CWpDjj5tTnZXCgavw | |
-! Homepage: http://ajnasz.hu/adblock | |
+[Adblock Plus 2.0] | |
+! Checksum: Cu8lpHD8LWPuacx+08xEpw | |
+! [Ajnasz Exception Rules]/whitelist | |
+||static*.origos.hu/s/img/szponzoraciok/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var referenceToEventListeners = {}, | |
etid = 0; | |
function getTargetIdFromTarget(target) { | |
target = target || document; | |
var targetId = target.id; | |
if (!targetId) { | |
targetId = 'Element' + ++etid; | |
target.id = targetId; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(app) { | |
var blockNodes, complexComputation, | |
findNodes, hiddenNodes, hide; | |
complexComputation = function () { | |
/* do some complex stuff and return a node */ | |
}; | |
findNodes = function(callback) { | |
var nodes = [], node; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var YUI = require('yui3').YUI; | |
YUI().use('nodejs-dom', 'node', 'event', function (Y) { | |
var document = Y.Browser.document; | |
var i = Y.Node.create('<i>asdf</i>'); | |
i.addClass('foo'); | |
Y.one('body').append(i); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
function mkdir_p_async(directory, position, callback) { | |
position = position || 0; | |
var dir = require('path').normalize(directory).split('/'); | |
if (position >= dir.length) { | |
callback(); | |
return; | |
} | |
var done = false; | |
var f = dir.slice(0, position + 1).join('/'); |