Skip to content

Instantly share code, notes, and snippets.

View nikitalarionov's full-sized avatar
🏠
Working from home

sphere89 nikitalarionov

🏠
Working from home
View GitHub Profile
@nikitalarionov
nikitalarionov / commandline.txt
Created March 11, 2019 21:05 — forked from sandervm/commandline.txt
Generate Django secret key commandline
$ python -c 'import random; print "".join([random.choice("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)") for i in range(50)])'
@nikitalarionov
nikitalarionov / memory_check.cpp
Created April 4, 2018 11:27 — forked from thirdwing/memory_check.cpp
C++ code to print out runtime memory usage
#include <iostream>
#include <fstream>
#include <unistd.h>
void process_mem_usage(double& vm_usage, double& resident_set)
{
vm_usage = 0.0;
resident_set = 0.0;
// the two fields we want
Snow Leo ships with ctags not suitable for Ruby development. Ie if you try to generate tags recursively, it will error out:
$ ctags -R
ctags: illegal option -- R
usage: ctags [-BFadtuwvx] [-f tagsfile] file ...
$ which ctags
/usr/bin/ctags
homebrew to the rescue:
Snow Leo ships with ctags not suitable for Ruby development. Ie if you try to generate tags recursively, it will error out:
$ ctags -R
ctags: illegal option -- R
usage: ctags [-BFadtuwvx] [-f tagsfile] file ...
$ which ctags
/usr/bin/ctags
homebrew to the rescue:
@nikitalarionov
nikitalarionov / js-observables-binding.md
Created December 20, 2017 11:20 — forked from austinhyde/js-observables-binding.md
Vanilla JavaScript Data Binding

Observables

You don't really need a framework or fancy cutting-edge JavaScript features to do two-way data binding. Let's start basic - first and foremost, you need a way to tell when data changes. Traditionally, this is done via an Observer pattern, but a full-blown implementation of that is a little clunky for nice, lightweight JavaScript. So, if native getters/setters are out, the only mechanism we have are accessors:

var n = 5;
function getN() { return n; }
function setN(newN) { n = newN; }

console.log(getN()); // 5

setN(10);

@nikitalarionov
nikitalarionov / timeBasedAnimationPattern.js
Created December 18, 2017 15:47 — forked from greypants/timeBasedAnimationPattern.js
JS: Time-based animation pattern
// Full Blog Post: http://viget.com/extend/time-based-animation
// requestAnimationFrame() polyfill: https://gist.github.com/1579671
window.APP = window.APP || {};
APP.pause = function() {
window.cancelAnimationFrame(APP.core.animationFrame);
};
APP.play = function() {
@nikitalarionov
nikitalarionov / fsm.js
Created October 19, 2016 11:07 — forked from hexode/fsm.js
Simple fsm
var fsm = (function() {
function transition(name, from, to) {
this.transitions[name] = {name: name, from: from, to: to};
return this;
}
function init(state) {
this.initState = state;
return this;
}
@nikitalarionov
nikitalarionov / bash-cheatsheet.sh
Created October 10, 2016 22:36 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@nikitalarionov
nikitalarionov / Enhance.js
Created February 12, 2016 12:31 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@nikitalarionov
nikitalarionov / README.md
Created January 11, 2016 12:24 — forked from Dr-Nikson/README.md
Auth example (react + redux + react-router)