Skip to content

Instantly share code, notes, and snippets.

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

Carlos Villuendas Zambrana carlosvillu

🏠
Working from home
View GitHub Profile
@javiyt
javiyt / build_docker_image.sh
Last active August 29, 2015 14:21
Docker useful commands
#!/bin/sh
docker build -t $1 .
@joonyou
joonyou / mongod init script
Created February 24, 2010 15:18
mongodb start script
#! /bin/sh
### BEGIN INIT INFO
# Provides: mongodb
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the mongodb data-store
# Description: starts mongodb using start-stop-daemon
@tcorral
tcorral / DefineSpecsAsModules.coffee
Created August 4, 2012 18:57
Mixing Require.js, Jasmine, Sinon.js and Backbone.
## ItemView.coffee in the specs/coffee folder ##
define ["ItemView"], (ItemView) ->
###
Specs for ItemView
###
describe "Item View", ->
###
Common setup and teardown
@delacruz-dev
delacruz-dev / recursive-git-sh
Created April 14, 2016 10:55
Bash script for updating recursively your git repositories given a root path
for dir in $(find . -name ".git"); do cd ${dir%/*}; git pull ; cd -; done
@nucliweb
nucliweb / npm.aliases.bash
Last active June 8, 2016 18:41
NPM Aliases for Bash-it
cite 'about-alias'
about-alias 'common npm abbreviations'
# Aliases
alias ni='npm install'
alias nis='npm install --save'
alias nid='npm install --save-dev'
alias nit='npm install-test'
alias nits='npm install-test --save'
alias nitd='npm install-test --save-dev'
@velsa
velsa / app.js
Created March 25, 2014 15:43
Express server used to launch ffmpeg, transcode stream from peerflix and serve it to HTML5 video tag
var express = require('express'),
http = require('http'),
path = require('path'),
child_process = require("child_process");
var app = express();
// Server settings
app.set('port', process.env.PORT || 9999);
app.use(express.favicon());
@RReverser
RReverser / better-console-log.js
Last active May 9, 2019 21:07
Better console.log in Node
// UPD:
// Now available as npm module!
// Check out https://github.com/RReverser/better-log for details.
console.log = (function (log, inspect) {
return function () {
return log.apply(this, Array.prototype.map.call(arguments, function (arg) {
return inspect(arg, { depth: 1, colors: true });
}));
};
@lixiaoyan
lixiaoyan / entry.js
Last active June 28, 2019 20:33
React 16: ReactDOM.hydrate(...)
import React from "react";
import ReactDOM from "react-dom";
import { AppContainer } from "react-hot-loader";
import App from "./App";
const render = (hydrate = false) => {
const container = document.querySelector("#app");
const element = (
<AppContainer>
// routes.js
const routes = [
{
path: '/',
component: Home,
exact: true
},
{
path: '/gists',
component: Gists
@getify
getify / 1.js
Last active September 29, 2021 11:58
experiment: mimicking React's new "useState()" hook for stand-alone functions, including "custom hooks"
"use strict";
[foo,bar] = TNG(foo,bar);
// NOTE: intentionally not TNG(..) wrapping useBaz(), so that it's
// basically like a "custom hook" that can be called only from other
// TNG-wrapped functions
function foo(origX,origY) {
var [x,setX] = useState(origX);
var [y,setY] = useState(origY);