Skip to content

Instantly share code, notes, and snippets.

View joeljuca's full-sized avatar
👨‍💻
Working on smt new

Joel Jucá joeljuca

👨‍💻
Working on smt new
View GitHub Profile
Name of thing Sorta like... Mounted? Can you even setState? What would you say... ya do here?
constructor initialize() nope nope init stuff NO side effects
componentWillMount beforeDomReady() nope yeah but don't Only needed in createClass now use constructor for most things
render render nope please no render stuff and don't set any state please
componentDidMount domReady() yup yup DOM is a go init jQuery plugins dispatch stuff
componentWillReceiveProps onChange() yup yup
@sigriston
sigriston / index.js
Last active October 22, 2016 20:25
streams-example
'use strict';
var util = require('util');
var stream = require('stream');
var Writable = stream.Writable || require('readable-stream').Writable;
function dbConnect(connectionString) {
console.log('connectionString',
connectionString);
return {
@joepie91
joepie91 / promises-reading-list.md
Last active June 25, 2023 09:12
Promises (Bluebird) reading list

Promises reading list

This is a list of examples and articles, in roughly the order you should follow them, to show and explain how promises work and why you should use them. I'll probably add more things to this list over time.

This list primarily focuses on Bluebird, but the basic functionality should also work in ES6 Promises, and some examples are included on how to replicate Bluebird functionality with ES6 promises. You should still use Bluebird where possible, though - they are faster, less error-prone, and have more utilities.

I'm available for tutoring and code review :)

You may reuse all gists for any purpose under the WTFPL / CC0 (whichever you prefer).

@sigriston
sigriston / Gruntfile.js
Last active August 29, 2015 14:14
grunt deploys via grunt-rsync
module.exports = function(grunt) {
// ...
grunt.initConfig({
//...
// Deploy settings (task config, put inside grunt.initConfig)
rsync: {
@addyosmani
addyosmani / README.md
Last active October 17, 2024 13:41 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

user http;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
events {
worker_connections 1024;
multi_accept on;
}
http {
@selenamarie
selenamarie / liberate.sql
Last active December 17, 2015 17:29
I wrote this as prep for a talk about JSON datatype and PLV8: https://speakerdeck.com/selenamarie/schema-liberation-with-json-and-plv8-and-postgres
CREATE SCHEMA liberated;
CREATE OR REPLACE FUNCTION public.liberate()
RETURNS boolean
LANGUAGE plv8
AS $function$
var tables = plv8.execute(
"select relname FROM pg_catalog.pg_class"
+ " c LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace"
@lnunesbr
lnunesbr / easymysqldump.sh
Created May 17, 2013 22:55
Shell script to backup MySql database (Performed for Drupal databases). It ignores drupal cache and temporary information common tables content, although it fits any mysql database dump. To backup a Mysql database file to a chosen directory you must provide the database name, and mysql access information through parameters in the script executio…
#!/bin/bash
# Shell script to backup MySql database (Performed for Drupal databases)
# It ignores drupal cache and temporary information common tables content,
# although it fits any mysql database dump.
# To backup a Mysql database file to a chosen directory you must provide the
# database name, and mysql access information through parameters in the script
# execution.
# Based on the original script on
# http://www.cyberciti.biz/nixcraft/vivek/blogger/2005/01/mysql-backup-script.html
# Last updated: May - 2013
<?php
/**
* Examples of valid statements for a drushrc.php file. Use this file to
* cut down on typing of options and avoid mistakes.
*
* Rename this file to drushrc.php and optionally copy it to one of
* five convenient places, listed below in order of precedence:
*
* 1. Drupal site folder (e.g sites/{default|example.com}/drushrc.php).
@gnarf
gnarf / ..git-pr.md
Last active October 17, 2024 18:48
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out