Skip to content

Instantly share code, notes, and snippets.

View isRuslan's full-sized avatar

Ruslan Ismagilov isRuslan

  • Yandex
  • Russia, Moscow
View GitHub Profile
@isRuslan
isRuslan / cl.sublime-snippet
Created June 16, 2014 09:46
Sublime Snippet "cl" - console.log( ${1} );
<snippet>
<content><![CDATA[
console.log( ${1} );
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>cl</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>
# count sloc of all *.js on root
find ./ -name "*.js" -exec cat '{}' \; | wc -l
@isRuslan
isRuslan / index.js
Created September 2, 2014 08:51
JS for node and browser.
(function(exports){
// your code goes here
exports.test = function(){
return 'hello world'
};
})(typeof exports === 'undefined'? this['mymodule']={}: exports);
@isRuslan
isRuslan / style
Created September 28, 2014 19:17
CSS layout hack.
// See how your layout looks like.
* { background-color: rgba(255,0,0,.2); }
* * { background-color: rgba(0,255,0,.2); }
* * * { background-color: rgba(0,0,255,.2); }
* * * * { background-color: rgba(255,0,255,.2); }
* * * * * { background-color: rgba(0,255,255,.2); }
* * * * * * { background-color: rgba(255,255,0,.2); }
@isRuslan
isRuslan / index.js
Created October 7, 2014 09:37
Trello developer task
#!/usr/bin/node
/**
* Trello task description: https://trello.com/jobs/developer
*/
/**
* @function hash Create hash from string
* @param {String} str String to hash
* @return {Number} hash
*/
@isRuslan
isRuslan / port
Created October 16, 2014 06:49
Which process uses port (OS X)?
# sudo allows you to get proccesses you don't own
sudo lsof -n -i4TCP:$PORT | grep LISTEN
@isRuslan
isRuslan / log.js
Created November 3, 2014 21:17
Date timer
/**
* When it was happend?
* https://github.com/zhukov/webogram/blob/master/app/js/lib/utils.js#L8
* console.log(dT(), 'foo');
* [17.567] foo
* console.log(dT(), 'bar');
* [23.290] bar
*/
var _logTimer = (new Date()).getTime();
@isRuslan
isRuslan / api.js
Created November 4, 2014 17:03
AngularJS API Service
'use strict';
/**
* Welcome to the Api module!
* This is wrapper of $http angular service for Seedr Backend.
* In .config we defined interceptor, for cheking statuses all of Seedr requests.
*/
angular.module('Seedr.api', [])
/**
* @service Api
@isRuslan
isRuslan / .vimrc
Created December 18, 2014 08:38
Vim config
" Just search by `/# ` to navigate between parts of the file
" # Behavior
set nocompatible
set nobackup
set noswapfile
set history=1000 " remember more commands and search history
" # UX
syntax enable
set title " Show the (partial) command as it’s being typed
@isRuslan
isRuslan / index.js
Created January 21, 2015 19:24
Check if it is a promise?
/**
* Check if `value` is a promise
* Future "native" ES6 promise you can just ckeck:
* value instanceof Promise
*/
function check (value) {
return value && 'then' in value && typeof value.then == 'function';
}