Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Azat Mardan azat-co

🎯
Focusing
Block or report user

Report or block azat-co

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Beaglefoot
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 {
width,
paddingLeft,
paddingRight,
marginLeft,
marginRight
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;
@tjor
tjor / bookmarklet
Created Sep 8, 2014
Bookmarklet Question
View bookmarklet
//Executed through a self-invoking anonymous function
(function(){
//declare the variables that we will need
var imgName = "10584590_588581994607732_199003263_n.jpg";
var uriA = "http://photos-e.ak.instagram.com/hphotos-ak-xfa1/10584590_588581994607732_199003263_n.jpg";
var uri1 = "http://instagram.com/p/sLLSiTCXB5/?modal=true";
var uri2 = "http://instagram.com/p/sLLSiTCXB5/";
@alexmingoia
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

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

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com 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:

githubUsers
  .filter(user => user.followers > 1000)
@aslam
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')
request.reset_session
flash[:notice] = "Signed out successfully."
end
end
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active Sep 19, 2019
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.
View node-and-npm-in-30-seconds.sh
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
You can’t perform that action at this time.