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
user http;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
events {
worker_connections 1024;
multi_accept on;
}
http {
<?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).
@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 {
@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
anonymous
anonymous / test-fatal-error.php
Created November 30, 2012 18:15
fazendo o tratamento de um fatal error no PHP
<?php
//se eu nao botar error_reporting = 0, ele vai mostrar a mensagem padrão do php mesmo assim =)
ini_set( 'error_reporting', 0 );
register_shutdown_function('shutdown');
function shutdown( )
{
$error = error_get_last();
if(($error['type'] === E_ERROR) || ($error['type'] === E_USER_ERROR))
@barraponto
barraponto / post-commit
Created August 17, 2012 23:57
Automatically dump Drupal database on commit
#! /bin/bash
# Set overridable filename format
: ${DRUPAL_DUMP_FORMAT:="%at-%h"}
filename="$( git log -n 1 --format=${DRUPAL_DUMP_FORMAT} ).sql" # see git help log for more on git formats
# Set overridable path
: ${DRUPAL_DUMP_PATH:="."} # path, relative to drupal root
path="$( cd `drush dd` ; realpath $DRUPAL_DUMP_PATH 2>&1 )"
@mpereira
mpereira / gist:3072187
Created July 8, 2012 18:26
A little help to stop unconsciously checking distracting web sites.
alias focus="sudo sh -c \"echo '127.0.0.1 www.facebook.com twitter.com mail.google.com # aab6de513ab5de9359809f3cdb62d352' >> /etc/hosts\""
alias unfocus='sudo sed -i "" "/aab6de513ab5de9359809f3cdb62d352/d" /etc/hosts'
@oliveiraev
oliveiraev / download_tweets.sh
Created June 20, 2012 16:41
Baixa todos os tuítes de um usuário com timeline pública
#!/bin/bash
if [ ! -d './downloaded_tweets' ]; then
mkdir downloaded_tweets
if [ ! -d './downloaded_tweets' ]; then
echo "Can't create output dir." > /dev/stderr
exit 1
fi
fi
cd downloaded_tweets