Skip to content

Instantly share code, notes, and snippets.

View jwcastillo's full-sized avatar
🏠
Working from home

José Wenceslao Castillo jwcastillo

🏠
Working from home
View GitHub Profile
@jwcastillo
jwcastillo / DB.sql
Last active September 1, 2015 14:16 — forked from msurguy/DB.sql
Dynamic dropdown in Laravel, let's say you have multiple drop downs (selects), you click on one and the contents of the other need to be dynamically changed. One solution is to dynamically load JSON from the API and change the dropdown dynamically depending on the user choice.
CREATE TABLE `makers` (
`id` int(10) unsigned NOT NULL,
`name` varchar(255) NOT NULL,
`description` varchar(255) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
@jwcastillo
jwcastillo / gulpfile.js
Last active September 2, 2015 10:17 — forked from laracasts/gulpfile.js
Example Laravel-specific Gulpfile from Laracasts.com
var gulp = require('gulp');
var gutil = require('gulp-util');
var notify = require('gulp-notify');
var sass = require('gulp-ruby-sass');
var autoprefix = require('gulp-autoprefixer');
var minifyCSS = require('gulp-minify-css')
var coffee = require('gulp-coffee');
var exec = require('child_process').exec;
var sys = require('sys');
@jwcastillo
jwcastillo / validarRUT.html
Created September 24, 2015 22:14 — forked from gaulatti/validarRUT.html
HTML5 Chilean RUT Validator
<!doctype html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Validador de RUT HTML5</title>
</head>
<body>
<form>
<input type="text" id="rut" name="rut" required oninput="checkRut(this)" placeholder="Ingrese RUT">
<button type="submit">Validar RUT y Enviar Form</button>
@jwcastillo
jwcastillo / reactjs_componentapi_cheatsheet.md
Created October 1, 2015 17:36 — forked from spoike/reactjs_componentapi_cheatsheet.md
React JS Cheatsheets for Component API, Specifications and Lifecycle

ReactJS Component Cheatsheet

To create a ReactComponent:

ReactComponent React.createClass(object proto)

Basic JSX example:

var TitleComponent = React.createClass({

// REQUIRED

@jwcastillo
jwcastillo / form.ejs
Created October 8, 2015 21:26 — forked from kanwarujjaval/form.ejs
Creating multiple forms with a single ejs file in node.js
<form action="<%= action %>" method="post">
<% if (fields.length) { %>
<% fields.forEach(function(field){ %>
<label><%= field.name %></label>
<input type="<%= field.type %>" name="<%= field.name %>" <% if (field.property) { %> <%= field.property %> <% } %> >
<% }) %>
<% } %>
<button type="submit"><%= title %></button> <!--Title for button is same as that of the page-->
@jwcastillo
jwcastillo / object-watch.js
Created October 13, 2015 17:42 — forked from eligrey/object-watch.js
object.watch polyfill in ES5
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@jwcastillo
jwcastillo / install-from-source-on-ubuntu-12.04-lts.md
Created October 21, 2015 10:28 — forked from dwayne/00-install-on-64-bit-ubuntu-14.04.md
Installing node and npm on Ubuntu 12.04 LTS and 64-bit Ubuntu 14.04 LTS.

Assumes a fresh install of Ubuntu 12.04 LTS.

  1. Setup the system to handle compiling and installing from source.

     $ sudo apt-get install build-essential
    
  2. If SSL support is needed then we will need to install libssl-dev.

     $ sudo apt-get install libssl-dev
    
@jwcastillo
jwcastillo / text.md
Created October 21, 2015 23:13 — forked from bajtos/text.md
LoopBack Replication & Offline sync

The offline data access & synchronization is built from three components:

  1. Change tracking
  2. Replication of changes
  3. Browser version of LoopBack

Setup

Enable change tracking

@jwcastillo
jwcastillo / 0_reuse_code.js
Created October 22, 2015 01:39
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jwcastillo
jwcastillo / example.js
Created October 28, 2015 00:27 — forked from samwgoldman/example.js
Pure, stateless, type-checked React components with Immutable.js and Flow
/* @flow */
var React = require("react")
var Immutable = require("immutable")
// In order to use any type as props, including Immutable objects, we
// wrap our prop type as the sole "data" key passed as props.
type Component<P> = ReactClass<{},{ data: P },{}>
type Element = ReactElement<any, any, any>