Skip to content

Instantly share code, notes, and snippets.

View juniorUsca's full-sized avatar

Junior Usca juniorUsca

View GitHub Profile
@paolorossi
paolorossi / html5-video-streamer.js
Created March 7, 2012 13:21
Node.js HTML5 video streamer
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
*/
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';
@gorbiz
gorbiz / trello-card-title-markdown.user.js
Last active September 12, 2023 05:50
Add support for bold and emphasized Markdown in Trello card titles using a User Script.
// ==UserScript==
// @name Trello card title Markdown
// @version 0.4.0
// @homepage https://gist.github.com/gorbiz/6062481
// @description Add support for bold and emphasized Markdown in card titles
// @match https://trello.com/b/*
// @match http://trello.com/b/*
// ==/UserScript==
function markdownAll() {
@lamchau
lamchau / logging.js
Created April 21, 2015 00:31
simple pretty log4j-like logging (requires chalk for color)
var util = require('util');
var chalk = require('chalk');
var LOG_TYPE = chalk.bold.black('[') + '%s' + chalk.bold.black(']') + ':';
var ALL = {
type: 'ALL'
};
var TRACE = {
type: 'TRACE',
fn: console.log,
@zeusdeux
zeusdeux / socketio.md
Last active March 18, 2020 22:51
Vanilla websockets vs socket.io

Vanilla websockets vs socket.io

Note: The points below are a comparison of using vanilla websockets on client and server and using 'em via socket.io and not about why only use socket.io

  • Native websockets provide us with only a send method to send data to the server. Send accepts only string input (not too sure about this). Socket.io lets us emit arbitrary events with arbitrary data (even binary blobs) to the server.
  • To receive messages on a vanilla websocket you can only assign a handler for the message event. The data you receive is mostly likely to be text (again not too sure about this) and you will have to parse it manually before consuming it. Socket.io lets the server and client both emit arbitrary events and handles all the parsing and packing/unpacking.
  • Socket.io gives us both a server and a client. Implementing a vanilla websocket server isn't something that you would want to do per project since it's quite painful. You will have to implement [RFC6455](https://tools.ietf.org/h
@juniorUsca
juniorUsca / generate_persons.js
Last active August 1, 2016 09:48
Generar personas para MongoDB
var nombres_synapticos = [ "Sergio Stanclift", "Robert Marceaux", "Martine Colle", "Hobert Shoptaw", "Danyell Steinruck", "Terry Villaluz", "Cammie Vandegrift", "Claire Vitale", "Shante Stlaurent", "Marnie Hiteman", "Shavonda Darter", "Myrle Schehr", "Clare Bowey", "Mittie Boldosser", "Stephenie Entwisle", "Frida Melendes", "Tawny Hankin", "Tinisha Decardo", "Augustus Schmuhl", "Will Jufer", "Jeni Keyl", "Angelika Cantillo", "Lenny Pietz", "Kati Liesmann", "Olivia Verdiguel", "Jeanice Jaruis", "Dawne Czach", "Jacques Perez", "Janene Lizarraga", "Joanna Burchell", "Rossana Brettmann", "Markus Granizo", "Mia Tejera", "Gina Coutch", "Burt Winkowski", "Rea Morcos", "Yasmin Hollenshead", "Karena Immerman", "Jeanett Mcanelly", "Teddy Vogl", "Kelle Jankoski", "Narcisa Hsun", "Lelah Matheson", "Elda Damiani", "Farah Krenke", "Sharan Konek", "Andrew Yennard", "Tanesha Tilford" ];
var intereses_synapticos = [ "musica", "arte", "juegos", "peliculas", "anime", "vida", "amanecer", "amor", "familia", "tv", "medio ambiente
@jcavat
jcavat / Dockerfile
Last active July 19, 2024 11:36
docker-compose with php/mysql/phpmyadmin/apache
FROM php:7.1.2-apache
RUN docker-php-ext-install mysqli
@juniorUsca
juniorUsca / tensor flow classifier example.md
Last active May 4, 2017 16:14
Tensorflow classifier example
  1. Instalar docker
curl -sSL https://get.docker.com/ | sh
sudo usermod -aG docker <tu-usuario>
  1. Descargar un dataset y organizar las imagenes en formato jpg por carpetas
@dankrause
dankrause / postgresql_recursive.sql
Last active February 26, 2024 16:03
An example of creating a recursive postgresql query to generate data about parent-child relationships within a single table.
CREATE TABLE test
(
id INTEGER,
parent INTEGER
);
INSERT INTO test (id, parent) VALUES
(1, NULL),
(2, 1),
@tinmegali
tinmegali / AppDatabse.kt
Last active January 12, 2023 13:44
Android Room @TypeConverter using Kotlin
@Database(entities = arrayOf(Note::class, User::class), version = 1)
@TypeConverters(Converters::class)
abstract class AppDatabse : RoomDatabase() {
abstract fun userDAO(): UserDAO
abstract fun noteDAO(): NoteDAO
}
@fazlurr
fazlurr / outsider.js
Created August 23, 2017 09:20
React Detect Click Outside Component - https://stackoverflow.com/a/42234988
/**
* Component that alerts if you click outside of it
*/
class OutsideAlerter extends Component {
constructor(props) {
super(props);
this.setWrapperRef = this.setWrapperRef.bind(this);
this.handleClickOutside = this.handleClickOutside.bind(this);
}