Skip to content

Instantly share code, notes, and snippets.

View jonathanrodriguezs's full-sized avatar

Jonathan Rodriguez jonathanrodriguezs

View GitHub Profile
@jeffrafter
jeffrafter / handler.js
Created April 2, 2010 20:59
Simple HTTP Server and Router in node.js
exports.createHandler = function (method) {
return new Handler(method);
}
Handler = function(method) {
this.process = function(req, res) {
params = null;
return method.apply(this, [req, res, params]);
}
}
@lancejpollard
lancejpollard / node-folder-structure-options.md
Created November 28, 2011 01:50
What is your folder-structure preference for a large-scale Node.js project?

What is your folder-structure preference for a large-scale Node.js project?

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin
@eliben
eliben / gist:5797351
Created June 17, 2013 14:36
Generic regex-based lexer in Python
#-------------------------------------------------------------------------------
# lexer.py
#
# A generic regex-based Lexer/tokenizer tool.
# See the if __main__ section in the bottom for an example.
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
# Last modified: August 2010
#-------------------------------------------------------------------------------
@lukehedger
lukehedger / ffmpeg-compress-mp4
Last active May 6, 2024 08:32
Compress mp4 using FFMPEG
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 6, 2024 07:22
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@vasanthk
vasanthk / System Design.md
Last active May 6, 2024 20:21
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@sjcotto
sjcotto / qrCode.js
Created May 5, 2016 20:07
Generate QR Code and save to mongodb
var json = {
email : "santiago@konacloud.io",
name : "Santiago Cotto"
};
var qr = require('qr-image');
var mongoose = require('mongoose');
var image = qr.imageSync(JSON.stringify(json), { type: 'png', size : 10 });
var Grid = require('gridfs');
@BritneyJo
BritneyJo / ES2015.md
Last active February 11, 2021 07:02

ES6 / ES2015

Learning Objectives

  • Understand what ES2015 is and how to use it
  • Exposure to and implementation of many of the most useful new features introduced in ES2015:
    • String Interpolation
    • Arrows
    • Let vs. Const vs. Var
    • Classes
@mdang
mdang / ES6_PRACTICE.md
Last active February 12, 2021 18:23
ES6 Practice

ES6 Practice

Convert the following ES5 code to ES6.

Template Literals

// Template literals
var li = '<li>' +
  '<div class="row">' +