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
// ==UserScript== | |
// @name OLX Previews | |
// @namespace http://use.i.E.your.homepage/ | |
// @version 0.1 | |
// @description Makes OLX (slando) render large image previews | |
// @match http://kiev.ko.olx.ua/nedvizhimost* | |
// @copyright 2015+, Yuriy Bogdanov | |
// ==/UserScript== | |
;(function(){ |
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
# Build stage: will start from google/golang:1.4 and compile app.go | |
FROM google/golang:1.4 | |
ADD . /src | |
WORKDIR /src | |
# Will result in putting app.o to the working directory /src | |
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -v -o app.o app.go | |
# Will make app.o available in the following FROM | |
EXPORT app.o | |
# Describe "run" image based on "busybox", weights 4.3MB |
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
namespace: nginx | |
containers: | |
# "shared" is the data volume container that holds nginx config files and static html files for | |
# the "nginx" container. It is empty from the beginning, but once "configs" container is started | |
# files are copied to the "shared" container with rsync(1) | |
# | |
# This container is designed to be persistent across deploys of both "nginx" and "configs" | |
# containers. | |
# |
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
/** | |
* Some existing external lib which you don't want to touch | |
*/ | |
var SomeModule = { | |
someAsyncFunction : function(callback) | |
{ | |
process.nextTick(function(){ | |
callback(null, 'result'); | |
}) |
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
/** | |
* Seq | |
*/ | |
var fs = require('fs'); | |
var exec = require('child_process').exec; | |
var Seq = require('seq'); | |
Seq() | |
.seq(function () { | |
exec('whoami', this) |
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
someObject = { | |
myNewMethod : function(a, b) // <-- no callback | |
{ | |
console.log(Fiber.current); // Inside of fiber | |
if (a == 1) | |
throw "'a' cannot be 1"; // we can use throw here | |
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 someAsyncFunction(param, callback) { | |
setTimeout(function(){ | |
callback(null, param); // result | |
}, 100) | |
} | |
Function.prototype.sync = function(param) { | |
this(param, function(e, result) { | |
Fiber.run(result); // substitute result instead of yield, resume current Fiber |
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 path = require('path') | |
, fs = require('fs') | |
, Sync = require('sync') | |
// Return a future which just pauses for a certain amount of time | |
function realish (p) { | |
return path.resolve(path.dirname(fs.readlink.sync(fs, p))) | |
} |
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 getUserSummary(userId, callback) | |
{ | |
async.parallel({ | |
user : function(callback) { | |
db.users.findUserById(userId, callback) | |
}, | |
tweets : function(callback) { | |
db.users.getTweets(userId, callback) |
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
createEdge : function(e, callback) | |
{ | |
var self = this, tryNum = 0, | |
isolateRetryAttempts = 20, | |
isolateRetryInterval = 1000; | |
callback = callback || function(){}; | |
if (!(e instanceof Edge) || !e.isValid()) { | |
return callback(new Error("Invalid edge passed")); |
OlderNewer