Skip to content

Instantly share code, notes, and snippets.

View neojp's full-sized avatar

Joan P. neojp

View GitHub Profile
@stagas
stagas / how-to-run-apache-and-node.js-together-the-right-way.markdown
Created December 24, 2010 14:45
How to run Apache and Node.js together (the right way)

Step 1

Get a VPS that offers 2 or more IP addresses.

Step 2

From the WHM cPanel, find the menu item Service Configuration, select Apache Configuration and then click on Reserved IPs Editor.

Step 3

@markupboy
markupboy / html5video.sh
Created February 8, 2011 15:43
automated conversion of a file to all three html5 compatible video formats - h.264, ogg, and webm
#!/bin/sh
####################################
# Output file for HTML5 video #
# Requirements: #
# - handbrakecli #
# - ffmpeg #
# - ffmpeg2theora #
# #
# usage: #
@danheberden
danheberden / gyazo.php
Created February 17, 2011 06:20 — forked from cowboy/gyazo.php
<?PHP
/*
* PHP upload for Gyazo - v1.2 - 02/16/2011
* http://benalman.com/news/2009/10/gyazo-on-your-own-server/
*
* Copyright (c) 2009 "Cowboy" Ben Alman
* Licensed under the MIT license
* http://benalman.com/about/license/
*/
@Rob-ot
Rob-ot / gist:1027804
Created June 15, 2011 18:53
javascript tilde operator with indexOf
> var a = ["a", "b"]
> a.indexOf("a")
0
> a.indexOf("b")
1
> a.indexOf("c")
-1
> ~a.indexOf("a")
-1
> ~a.indexOf("c")
@chrisgemignani
chrisgemignani / basic-raphael-map.html
Created July 14, 2011 23:36
Simple Raphael Maps using D3 Projections
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Simple Raphael Maps Using D3 Projections</title>
<script type="text/javascript" charset="utf-8" src="raphael-min.js"></script>
<script type="text/javascript" charset="utf-8" src="geo-projection.js"></script>
<script type="text/javascript" charset="utf-8" src="us.svg.js"></script>
Subject: Thanks for signing up!
Date: {{date}}
To: {{recipient}}
From: {{sender}}
MIME-Version: 1.0
Content-Type: text/plain
Thanks for signing up for the Foobar service!
Your email address is: {{recipient}}
@styledev
styledev / Parse Tweet Message to Link Entities
Last active March 24, 2016 16:24
This function will linkify your tweet messages from the Twitter API using include_entities=true
@mpneuried
mpneuried / pubsub.coffee
Last active December 10, 2015 23:28
Simple namespaced Pub/Sub coffee class to use as extendable module for NodeJS and the browser.
# # PubSub
#
# Is a small helper to simply realize a pub/sub pattern to a coffee class.
#
# A namespaceing of the topics is also included.
# This means you can subscribe to `a` and also get the `a.b`. But if you subscribe to `a.b` you will not get a `a`.
#
# **required module**: `underscore`
#
class PubSub
var cluster = require('cluster');
var PORT = +process.env.PORT || 1337;
if (cluster.isMaster) {
// In real life, you'd probably use more than just 2 workers,
// and perhaps not put the master and worker in the same file.
cluster.fork();
cluster.fork();
cluster.on('disconnect', function(worker) {
@ravenlp
ravenlp / parse.js
Created June 20, 2013 05:26
NodeJs script to parse webpages and send data to Arduino via Serial connection
#!/usr/bin/env node
/* Info that is likely to be different for you */
var ARDUINO_PORT = "/dev/tty.usbserial-A1004c6U",
URL = 'http://www.cotizacion-dolar.com.ar/',
FETCH_CICLE = 30 * 60 * 1000;
/* Probably it's not a good idea to modify the following lines */
var jsdom = require("jsdom"),
sp = require("serialport"),