Skip to content

Instantly share code, notes, and snippets.

View zrobit's full-sized avatar

zrobit ⚡️ zrobit

View GitHub Profile
@zrobit
zrobit / react-server-handler.jsx
Created January 18, 2017 01:20
funcion middleware que maneja react para server side render
import { renderToString } from 'react-dom/server'
import { match, RouterContext } from 'react-router'
import routes from './routes'
serve((req, res) => {
// Note that req.url here should be the full URL path from
// the original request, including the query string.
match({ routes, location: req.url }, (error, redirectLocation, renderProps) => {
if (error) {
res.status(500).send(error.message)
@zrobit
zrobit / index.js
Created January 17, 2017 08:56
waterline orm load on express app server startup
var config = {
dir: './models',
adapters: {
'memory': require('sails-memory')
},
connections: {
default: {
adapter: 'memory'
@zrobit
zrobit / hook.js
Created January 17, 2017 06:13
usando babel register es6 en node server
//esto agrega babel a cualquier código escrito en es6 en el servidor,
//solo para entorno de desarrollo
require("babel-register")({
presets: ['es2015', 'react'],
plugins: [
'transform-decorators-legacy',
'transform-class-properties'
]
});
@zrobit
zrobit / gulp-stylus-bare.js
Created September 16, 2016 02:25
gulp stylus bare task
var gulp = require('gulp'),
stylus = require('stylus'),
nib = require('nib'),
through = require('through2');
function stylus_raw(){
function stream(){
function compile(file, enc, cb){
var compiled;
var options = {
@zrobit
zrobit / gulp-jade-bare.js
Created September 16, 2016 02:24
gulp jade pare task
var gulp = require('gulp'),
jade = require('jade'),
through = require('through2');
function jade_raw () {
function stream () {
function compile (file, enc, cb) {
var compiled;
var options = {
// Jade options goes here :)
@zrobit
zrobit / package.json
Last active January 30, 2016 06:04
Mi lista de npm modules más utilizados
{
"name": "npm-modules",
"version": "0.0.0",
"description": "mi lista npm modules mas usados",
"repository": {
"type": "git",
"url": ""
},
"author": "zrobit",
"license": "ISC",
[(site:"*gob.pe") + (filetype:pdf | filetype:pdfx | filetype:pptx | filetype:docx | filetype:xlsx)]
@zrobit
zrobit / gulpfile.js
Created January 7, 2016 01:52
receta para para compilar jade sin el plugin gulp-jade
var gulp = require('gulp'),
jade = require('jade'),
through = require('through2');
var templates = function(){
var render = function(){
function compile(file, enc, cb){
var compiled;
var contents = String(file.contents);
//aqui va tu data pero podrías cargarlo desde un archivo con require
@zrobit
zrobit / gist:bb934418304b9ccea903
Created September 17, 2015 05:03
jquery initial, best practice
// IIFE - Immediately Invoked Function Expression
(function($, window, document) {
// The $ is now locally scoped
// Listen for the jQuery ready event on the document
$(function() {
// The DOM is ready!
// PONG.cpp : main project file.
#include "stdafx.h"
#include <conio.h>
#include <stdio.h>
#include <math.h>
#include <windows.h>
using namespace System;