Skip to content

Instantly share code, notes, and snippets.

fs = require('fs')
Flightplan = require("./.node_modules/flightplan") # we need to install flightplane to .node_modules for meteor to ignore it
path = require('path')
plan = new Flightplan()
releaseFile = "release.tar.tgz" # name of the bundle generated by meteor
workPath = '/home/user/path' # path to the project folder
releaseFolder = 'rel' + Date.now()
@Termina1
Termina1 / gist:8c9da9857b3a08f163db
Created November 19, 2014 15:17
paper php-fpm ab
Server Software: nginx/1.4.6
Server Hostname: paperpaper.ru
Server Port: 80
Document Path: /
Document Length: 37679 bytes
Concurrency Level: 1
Time taken for tests: 711.723 seconds
Server Software: nginx/1.4.6
Server Hostname: paperpaper.ru
Server Port: 80
Document Path: /
Document Length: 34971 bytes
Concurrency Level: 1
Time taken for tests: 413.202 seconds
Complete requests: 1000
@Termina1
Termina1 / sync-example.js
Last active August 29, 2015 14:17
latency-effect-1
function getValue(id, cache, retrieveValue) {
if(cache.has(id)) {
return cache.get(id);
} else {
// синхронный запрос к удаленному источнику
return retrieveValue(id);
}
}
function getValue(id, cache, retrieveValue) {
if(cache.has(id)) {
return cache.get(id);
} else {
return new Promise(function(ful, rej) {
retrieveValue(id, ful, rej);
});
}
}
// длинный вариант
function getValue(id, cache, retrieveValue) {
return new Promise(function(ful, rej) {
if(cache.has(id)) {
ful(cache.get(id))
} else {
rej(false);
}
}).catch(function() {
@Termina1
Termina1 / lambda.js
Created October 14, 2011 13:27
Provides easy way of chain calling of one anonymous function with different params
var lambda = function(func) {
var fn = function() {
func.apply(this, arguments);
return fn;
}
return fn;
}
@Termina1
Termina1 / gist:1718623
Created February 1, 2012 18:51
Function that taps
lamdba = (func) ->
fn = ->
func.apply @, arguments
fn
fn
@Termina1
Termina1 / gist:2167808
Created March 23, 2012 06:49
The worst SCSS code, I've ever seen
@import "compass";
@mixin pagefont($size, $color, $fontweight){
font: $size Helvetica, Arial, sans-serif;
color: $color;
font-weight: $fontweight;
}
@mixin button($selector, $sprite, $color){
#{$selector}{
display: block;
overflow: hidden;
@Termina1
Termina1 / gist:2219907
Created March 27, 2012 20:15
Function with outter state
generator = (times, callback) ->
i = 0
->
i++
if i is times
do callback
# this pattern allows you to generate a new function with binded variables, that can be changed in this function, and also
# affect next calls.