Skip to content

Instantly share code, notes, and snippets.

View azat-co's full-sized avatar
🎯
Focusing

Professor Azat Mardan azat-co

🎯
Focusing
View GitHub Profile
@Beaglefoot
Beaglefoot / find-horizontal-scroll.js
Last active January 22, 2018 22:02
Find elements whose width is greater than window.innerWidth, possibly resulting in appearance of horizontal scroll.
// 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 {
width,
paddingLeft,
paddingRight,
marginLeft,
marginRight
@paulirish
paulirish / bling.js
Last active November 3, 2024 17:03
bling dot 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;
@alexmingoia
alexmingoia / gist:4db967e5aeb31d84847c
Last active August 3, 2018 22:48
Beyond Angular and Backbone with Undirectional apps

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

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

  • Express Docs, if you want to get started and already know JavaScript this is the place to be
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
@paulmillr
paulmillr / active.md
Last active October 25, 2024 01:23
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The list would not be updated for now. Don't write comments.

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Because of GitHub search limitations, only 1000 first users according to amount of followers are included. If you are not in the list you don't have enough followers. See raw data and source code. Algorithm in pseudocode:

githubUsers
@aslam
aslam / application.rb
Created December 10, 2010 06:10
Rails 3 reset session using devise (actually not using devise)
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')
request.reset_session
flash[:notice] = "Signed out successfully."
end
end
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active November 2, 2024 12:56
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ 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 http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh