Skip to content

Instantly share code, notes, and snippets.


Azat Mardan azat-co

View GitHub Profile
aslam / application.rb
Created Dec 10, 2010
Rails 3 reset session using devise (actually not using devise)
View application.rb
class ApplicationController < ActionController::Base
before_filter :save_or_clear_session
def save_or_clear_session
if controller_name.eql?('sessions') and action_name.eql?('destroy')
flash[:notice] = "Signed out successfully."
View migration.js
var async = require('async');
var ProgressBar = require('progress');
var monk = require('monk');
var ObjectId=require('mongodb').ObjectID;
var dest = monk('localhost:27017/storify_localhost');
var backup = monk('localhost:27017/storify_backup');
var userId = ObjectId(YOUR-OBJECT-ID); // monk should have auto casting but we need it for queries
Beaglefoot / find-horizontal-scroll.js
Last active Jan 22, 2018
Find elements whose width is greater than window.innerWidth, possibly resulting in appearance of horizontal scroll.
View find-horizontal-scroll.js
// Throw this into dev console and set 'max-width: 100%' for returned list of elements
Array.from(document.querySelectorAll('*')).filter(el => {
if (el.getBoundingClientRect().width > window.innerWidth) return true;
const {
alexmingoia / gist:4db967e5aeb31d84847c
Last active Aug 3, 2018
Beyond Angular and Backbone with Undirectional apps
View gist:4db967e5aeb31d84847c

Beyond Angular and Backbone with Unidirectional apps

What is a unidirectional app?

Unidirectional is a term coined by React engineers to describe the data flow of an application. Unidirectional apps employ functional reactive programming techniques such as immutability, purity, and most importantly unidirectional (as opposed to bidirectional) data flow.

A unidirectional app is defined by no mutable references no two-way references between concerns.

Unidirectional app flowchart

View nodejs_resource.markdown

Node.js Resources

What is node.js?

Node.js is just JavaScript running on the server side. That's it. That's all there is to it.


  • Express Docs, if you want to get started and already know JavaScript this is the place to be
View bling.js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
NodeList.prototype.__proto__ = Array.prototype;
isaacs /
Last active Jun 18, 2021
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl | sh
paulmillr /
Last active Jun 18, 2021
Most active GitHub users (by contributions).

Most active GitHub users (

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at from Tue, 06 Dec 2016 17:06:46 GMT till Wed, 06 Dec 2017 17:06:46 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

  .filter(user => user.followers > 1000)