Skip to content

Instantly share code, notes, and snippets.

Avatar
🇺🇦

Roman Liutikov roman01la

🇺🇦
View GitHub Profile
View Preferences.sublime-settings
{
"color_scheme": "Packages/User/base16-ocean.dark (SL).tmTheme",
"ensure_newline_at_eof_on_save": true,
"font_size": 11,
"save_on_focus_lost": true,
"tab_size": 2,
"theme": "Spacegray.sublime-theme",
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true
}
View fwajax3.js
function FwAjax3(host, cb) {
var req = function() {
try{ return new XMLHttpRequest();} catch(e){}
try{ return new ActiveXObject("Msxml2.XMLHTTP.6.0") }catch(e){}
try{ return new ActiveXObject("Msxml2.XMLHTTP.3.0") }catch(e){}
try{ return new ActiveXObject("Msxml2.XMLHTTP") }catch(e){}
try{ return new ActiveXObject("Microsoft.XMLHTTP") }catch(e){}
return null;
}(),
boundary = function () {
View index.js
$('#header').append('<a href="/callback/call_form.php" class="call-btn" style="display:block;width:100px;height:100px;background:#666;"></a>');
$('a.call-btn').fancybox({
type: 'iframe',
width: 506,
height: 638
});
@roman01la
roman01la / sublime-plugins
Created April 14, 2014 12:29
sublime plugins
View sublime-plugins
- Diff
- EditorConfig
- Emmet
- HTML-CSS-JS Prettify
- JSHint
- Local History
- Sass
- SideBarEnhancements
- SublimeLinter
- SublimeLinter-css-lint
View install.sh
#!/bin/bash
# Install curl if not found
if ! type "curl" > /dev/null; then
sudo apt-get update
sudo apt-get install curl -y
fi
# Install nvm
curl https://raw.githubusercontent.com/creationix/nvm/v0.7.0/install.sh | sh
@roman01la
roman01la / app.js
Last active August 29, 2015 14:04
HTTP resource JavaScript class for consuming REST API resources
View app.js
import HttpResource from 'xhr';
var items = new HttpResource('/api/items');
items.query(function* (resume) {
yield items.create([
{name: 'Item #1'},
{name: 'Item #2'},
{name: 'Item #3'}
@roman01la
roman01la / standard-deviation.js
Created September 22, 2014 20:21
Standard Deviation
View standard-deviation.js
function standardDeviation (values) {
var avg = average(values);
var squareDiffs = values.map(function (value) {
var diff = value - avg,
sqrDiff = diff * diff;
return sqrDiff;
@roman01la
roman01la / fetch.js
Last active August 29, 2015 14:07
Fetch.js
View fetch.js
var fetch = function (url) {
return new Promise(function (resolve, reject) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.onload = function() {
if (xhr.status === 200) {
resolve(xhr);
View .vimrc
" Make Vim more useful
set nocompatible
" Use the OS clipboard by default (on versions compiled with `+clipboard`)
set clipboard=unnamed
" Enhance command-line completion
set wildmenu
" Allow cursor keys in insert mode
set esckeys
" Allow backspace in insert mode
set backspace=indent,eol,start
@roman01la
roman01la / DB-class.js
Created December 9, 2014 19:15
ES7 async/await
View DB-class.js
class DB {
constructor (name) {
this.name = name;
this.collections = {};
this.async = function (callback, timeout) {
return new Promise((resolve, reject) => {
if (!callback) { return reject('Error!'); }