Skip to content

Instantly share code, notes, and snippets.

View mzvast's full-sized avatar
🎯
Focusing

mzvast mzvast

🎯
Focusing
View GitHub Profile
function Polygon(height, width) { //class constructor
this.name = 'Polygon';
this.height = height;
this.width = width;
}
Polygon.prototype = {
sayName: function () { //class method
console.log('Hi, I am a ' + this.name + '.');
}
let [one, two] = [1, 2];
let {a:three, b:four} = {a: 3, b: 4};
console.log(one, two, three, four); // 1 2 3 4
function* range(start, end, step) {
while (start < end) {
yield start;
start += step;
}
}
for (let i of range(0, 10, 2)) {
console.log(i);
}
// Generated on 2014-07-08 using generator-angular 0.9.3
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
var modRewrite = require('connect-modrewrite');
@jaredpalmer
jaredpalmer / prefetch.js
Created October 19, 2017 14:27 — forked from acdlite/prefetch.js
Prefetching in React
function prefetch(getKey, getValue, getInitialValue, propName) {
const inFlight = new Set();
const cache = new Map();
return ChildComponent => {
return class extends React.Component {
state = {value: getInitialValue(this.props)};
componentWillReceiveProps(nextProps) {
const key = getKey(nextProps);
if (cache.has(key)) {
// Use cached value
@xelwarto
xelwarto / jenkins_haproxy_config.cfg
Created May 25, 2015 11:49
Jenkins CI haproxy configuration example
global
chroot /var/lib/haproxy
crt-base /etc/pki/tls/certs
daemon
group haproxy
log 127.0.0.1 local0
maxconn 2000
pidfile /var/run/haproxy.pid
stats socket /var/lib/haproxy/stats
tune.ssl.default-dh-param 2048
@sogko
sogko / app.js
Last active November 8, 2022 12:31
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
@arttuladhar
arttuladhar / install_ec2.sh
Last active May 6, 2023 03:04
Installing tmux on EC2
# Installing tmux on Amazon-EC2
# If you don't have libevent install use wget to install the libevent and install
wget https://github.com/downloads/libevent/libevent/libevent-2.0.18-stable.tar.gz
tar zxf libevent-2.0.18-stable.tar.gz
sudo ./configure & sudo make install
# If you don't have curses install use yum to install the curses

Uninstall brew package and dependencies

Remove package's dependencies (does not remove package):

brew deps [FORMULA] | xargs brew remove --ignore-dependencies

Remove package:

@learncodeacademy
learncodeacademy / gist:ebba574fc3f438c851ae
Created July 24, 2014 14:47
Nginx Node Frontend / Load Balancer / Static Assets Caching
upstream project {
server 22.22.22.2:3000;
server 22.22.22.3:3000;
server 22.22.22.5:3000;
}
server {
listen 80;
location / {