Skip to content

Instantly share code, notes, and snippets.

// 1 - try / catch doesn't work with async codes, so you don't need to use
// 2 - You need to add a callback to be trigered when everything had run
module.exports = {
createNewUser: function (user, callback){
connection.query('INSERT INTO users (email, first_name, last_name, password) VALUES ("'+user.email+'", "'+user.first_name+'", "'+user.last_name+'", "'+user.password+'")' , function(err, result) {
// We will pass the error and the result to the function
callback(err, result);
});
}
Internet
|
Varnish
|
nginx
|
PHP-fpm - PHP-apm
| |-------|
| Redis
MariaDB ----|
@cranic
cranic / gist:9663995
Created March 20, 2014 13:43
Client de comandos por chat do Twitch.tv
var express = require('express');
var app = express();
var http = require('http').createServer(app);
var io = require('socket.io').listen(http);
var irc = require('irc');
var commands = ['up', 'down', 'left', 'right', 'reset'];
// Conexão com o IRC do canal
var client = new irc.Client('irc.twitch.tv', 'cooplays', {
nick: 'cooplays',
var meth1 = funciton(){
// Do things here
if(gotoMeth2)
meth2();
else
meth3();
};
var meth2 = function(){
Vamos iniciar os trabalhos de mais um novo meetup, eis o cronograma para março:
09:30 - 10:00 Chegada e recepção dos noders
10:00 - 10:30 Apresentação dos palestrantes, formalidades, etc..
10:30 - 11:00 Palestra relâmpago (vaga em aberto)
11:00 - 12:00 Palestra principal (vaga em aberto)
12:00 - 13:00 Almoço
13:00 - 13:30 Palestra relâmpago (vaga em aberto)
13:30 - 14:00 Palestra relâmpago (vaga em aberto)
14:00 - 14:30 Brainstorm e inscrição para ajudar no portal da comunidade
/*
Setup a server, RTC and face tracking
Install opencv
brew install opencv
NPM
https://www.npmjs.org/package/fs
https://www.npmjs.org/package/http
https://www.npmjs.org/package/express
https://www.npmjs.org/package/socket.io
var net = require('net');
var client = new net.Socket();
client.connect(8080, '192.168.0.1');
client.on('connect', function(){
console.log('Estamos conectados');
// Aqui é o momento ideal para enviar dados;
client.write('PCCSMDR');
This file has been truncated, but you can view the full file.
;(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/**
* @license AngularJS v1.2.11
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, angular, undefined) {'use strict';
/**
* @ngdoc overview
require('./jquery.js');
require('./angular.js');
require('./angular-route.js');
require('./bootstrap.js');
{
_id : 'myId',
engines : [
{name : 'html5', status : 'ready'}},
{name : 'java', status : 'ready'}},
{name : 'flash', status : 'queued'}
]
}