Skip to content

Instantly share code, notes, and snippets.

View mctep's full-sized avatar

Konstantin Vasilev mctep

View GitHub Profile
var _ = require('underscore');
var when = require('promised-io/promise');
module.exports = {
selectKeywordsAll: function() {
return this.conn.query('select * from `search.keywords`');
},
getKeywordById: function(id) {
return this.conn.query('select * from `search.keywords` where id = ?', [ id ]);
@mctep
mctep / gist:7264897
Last active December 27, 2015 04:09
/**
* Starts timer
* @return {Number} Start timestamp
*/
context.prototype.timeStart = function() {}
/**
* Returns
* @param {Number} tstmp Start timestamp
* @return {Number} Time difference in ms
@mctep
mctep / dabblet.css
Created October 2, 2013 09:19
Untitled
.list {
height: 100px;
overflow: hidden;
height: 100px;
}
.h {
height: 100%;
width: 1px;
border: 1px solid red;
@mctep
mctep / gist:5822230
Created June 20, 2013 12:12
Draft time left counter. Return how much time had left from timestamp.
timec.i18n('en-US', function(frame, value) {
var plural = !(value[value.length - 1] == 1);
switch frame {
case this.DAY: {
return plural
? 'days'
: 'day'
} break;
@mctep
mctep / gist:5787849
Created June 15, 2013 11:38
JSON Strorage
var jsonStorage = {
get: function(key) {
try {
return JSON.parse(localStorage.getItem(key)) || null;
} catch(e) {
return null;
}
},
set: function(key, value) {
if (key && undefined !== value) {
@mctep
mctep / gist:5143075
Last active December 14, 2015 20:19
// data: { foo: { bar: { name: 'bar' } } }
match / {
apply .foo content
}
match .foo content {
mustBeConst = { bar: { name: 'new bar' } }
// клеим в foo новый bar
// получается { foo: { bar: [ { name: 'bar' }, { name: 'new bar' }] } }
@mctep
mctep / dabblet.css
Created February 21, 2013 12:53
Untitled
body,
html {
padding: 0;
margin: 0;
height: 100%;
}
.page {
position: relative;
height: 100%;
@mctep
mctep / dabblet.css
Created February 21, 2013 12:52
Untitled
body,
html {
padding: 0;
margin: 0;
height: 100%;
}
.page {
position: relative;
height: 100%;
@mctep
mctep / dabblet.css
Created February 21, 2013 12:51
Untitled
body,
html {
padding: 0;
margin: 0;
height: 100%;
}
.page {
position: relative;
height: 100%;
@mctep
mctep / dabblet.css
Created February 21, 2013 12:50
Untitled
body,
html {
padding: 0;
margin: 0;
height: 100%;
}
.page {
position: relative;
height: 100%;