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 https = require('https'), | |
events = require('events'); | |
const userAgent = 'GCLNodejs'; | |
const version = 0.1; | |
const loginURL = '/accounts/ClientLogin'; | |
const googleHost = 'www.google.com'; | |
/** | |
* Helps to log in to any google service with the clientlogin method |
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 | |
# Must be called with two command-line args. | |
# Example: git-svn-relocate.sh http://old.server https://new.server | |
if [ $# -ne 2 ] | |
then | |
echo "Please invoke this script with two command-line arguments (old and new SVN URLs)." | |
exit $E_NO_ARGS | |
fi |
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
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | |
<title>A</title> | |
</head> | |
<body> | |
<a href="javascript:(function(){var doc=document,a=Array.prototype.slice.call(doc.querySelectorAll('h2.title a')).filter(function (a) {return a.href!==''&&a.parentNode.className!=='nnew';}),b=doc.createElement('span');a.forEach(function(l,i){var c=b.cloneNode(true),id='plusone'+i;c.id=id;a[i].parentNode.appendChild(c);gapi.plusone.render(id,{size:'small',count:true,href:l.href});});Array.prototype.slice.call(doc.querySelectorAll('.comment')).forEach(function(comment,i){var href=comment.previousSibling.previousSibling.id;if(href){var span=doc.createElement('span'),id='commentcount'+i;span.id=id;comment.querySelector('.submitted').appendChild(span);gapi.plusone.render(id,{href:doc.location.href+'#'+href,count:true,size:'small'});}});}()); | |
">+1</a> | |
</body> | |
</html> |
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
/* override require for testing, comment it out */ | |
var require = function (what, cb) { | |
console.log('request: ' + what.join(', ')); | |
setTimeout(function () { | |
require.ready(cb); | |
}, 300); | |
}; | |
require.ready = function (cb) { | |
cb(); | |
}; |
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 () { | |
var a = ['lorem', 'ipsum', 'dolor']; | |
var repeat = true; | |
var i = 0; | |
var f = function () { | |
console.log(a[i]); | |
var finished = i + 1 >= a.length; | |
if (!finished || repeat) { | |
i = finished && repeat ? 0 : i + 1; |
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
git log --grep=... --format=format:%b | awk '/@/ {print gensub(/^.*@([0-9]+).*$/, "\\1", 1)}' | sort -n | tr '\n' ',' |
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 | |
# Precommit hook to check js syntax | |
gitstatus=$(git st --short | awk '/^M.+js$/ {print $2}'); | |
echo $gitstatus | while read i; do | |
if [ ! -z "$i" ]; then | |
echo "parse: $i"; | |
output=$(js -e "parse(read('$i'))" 2>&1); | |
if [ ! -z "$output" ]; then |
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; |