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
if(webkitNotifications && webkitNotifications.checkPermission() === 1) { | |
$('.menu > ul').append('<li><a href="javascript:webkitNotifications.requestPermission();location.reload()">Notifications</a>'); | |
} | |
else if(webkitNotifications && webkitNotifications.checkPermission() === 0) { | |
var notificationCounter = Date.now(); | |
setInterval(function() { | |
$.getJSON('/api/notification/unseen', function(data) { | |
data = data.notifications; | |
if(data.length === 0) return; | |
if( |
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
yawn@xolotl:~/Codes/imago $ npm install | |
> browserjet@0.1.0 install /home/yawn/Codes/imago.jit.su/node_modules/browserjet | |
> ./install.py | |
--2012-06-09 18:55:49-- http://releases.browserjet.com/browserjet-linux-64bit-latest.tar.bz2 | |
Resolving releases.browserjet.com (releases.browserjet.com)... 74.207.244.30 | |
Connecting to releases.browserjet.com (releases.browserjet.com)|74.207.244.30|:80... connected. | |
HTTP request sent, awaiting response... 200 OK | |
Length: 17057998 (16M) [application/x-bzip2] |
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
[yawn@xolotl resourceful]$ node | |
> var m = require('./models/'); | |
undefined | |
> m.User.create({username: 'pwd', password:'pwd',salt:'asd'}, function(e, i) { console.log(i); }); | |
undefined | |
> { username: 'pwd', | |
salt: 'asd', | |
password: 'pwd', | |
ctime: 1342266826474, | |
mtime: 1342266826474, |
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 o = require('oauth'); | |
var oauth = new o.OAuth2("BUH", "amhar9ekAKv5QLio", "http://localhost:8000/", "oauth/authorize", "oauth/token") | |
oauth.getAuthorizeUrl({redirect_uri: "http://localhost:8080/callback", response_type: "code" }) // visiti sta url dal browser e ti segni il codice che ritorna | |
oauth.getOAuthAccessToken("dcL30MMCj1QLz2kM", {grant_type: 'authorization_code', "redirect_uri": "http://localhost:8080/callback"}, function() { console.log(arguments); }); | |
/*{ '0': null, | |
'1': '8IOsH9X73yiiv2CiqmqoASv0ECj4YHxQGkGmvz75UMf78IH9QFdd', | |
'2': undefined, |
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
defmodule Bot do | |
alias :gen_tcp, as: Socket | |
def connect(server, port) do | |
{:ok, sock} = Socket.connect(server, port, [:binary, {:packet, 0}]) | |
Socket.send sock, "NICK elixir_bot" | |
Socket.send sock, "USER elixir_bot 0 * elixir_bot" | |
Socket.send sock, "JOIN #testo" | |
receive do | |
{tcp, sock, data} -> IO.puts data |
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
defmodule Bot do | |
alias :gen_tcp, as: Socket | |
def connect(server, port) do | |
{:ok, sock} = Socket.connect(server, port, [:binary, {:packet, :line}]) | |
#Socket.send sock, "NICK elixir_bot" | |
#Socket.send sock, "USER elixir_bot 0 * elixir_bot" | |
#Socket.send sock, "JOIN #testo" | |
#do_loop(sock) | |
end |
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 Emitter = require('events').EventEmitter; | |
exports.async = function(arr, fn, done) { | |
var todo = arr.length, | |
em = new Emitter(); | |
em.on('done', function() { | |
if(!(--todo)) { done(); } | |
}); | |
arr.forEach(function(item) { |
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
// test | |
test(function(e, res) { | |
res.doSomething(function(err, herp) { | |
console.log('IMMA BE NESTED'); | |
}) | |
(nested, nested2); | |
}) | |
(param, param2); |
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(e,t,n){function i(e){return e}function s(e){return decodeURIComponent(e.replace(r," "))}var r=/\+/g,o=e.cookie=function(r,u,a){if(u!==n){a=e.extend({},o.defaults,a),u===null&&(a.expires=-1);if(typeof a.expires=="number"){var f=a.expires,l=a.expires=new Date;l.setDate(l.getDate()+f)}return u=o.json?JSON.stringify(u):String(u),t.cookie=[encodeURIComponent(r),"=",o.raw?u:encodeURIComponent(u),a.expires?"; expires="+a.expires.toUTCString():"",a.path?"; path="+a.path:"",a.domain?"; domain="+a.domain:"",a.secure?"; secure":""].join("")}var c=o.raw?i:s,h=t.cookie.split("; ");for(var p=0,d;d=h[p]&&h[p].split("=");p++)if(c(d.shift())===r){var v=c(d.join("="));return o.json?JSON.parse(v):v}return null};o.defaults={},e.removeCookie=function(t,n){return e.cookie(t)!==null?(e.cookie(t,null,n),!0):!1}})(jQuery,document) |
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 http = require('http'), | |
mongodb = require('mongodb'); | |
var db = new mongodb.Db('*********************', new mongodb.Server('alex.mongohq.com', 10086, {})); | |
var inc = 0; | |
db.open(function (err, db_p) { | |
if (err) { throw err; } | |
db.authenticate('nodejitsu', '********************', function (err, replies) { |
OlderNewer