Skip to content

Instantly share code, notes, and snippets.

View alexsandro-xpt's full-sized avatar

Alexsandro Souza Pereira alexsandro-xpt

View GitHub Profile
@alexsandro-xpt
alexsandro-xpt / gist:2782358
Created May 24, 2012 15:52 — forked from vquaiato/gist:2782117
Map/Reduce no MongoDB

###Collections Salas{_id} Reservas{_id, sala_id, data}

###Preciso contar as reservas de cada sala por uma data:

map = function () {
    emit(this.sala_id, [1]);
}
@alexsandro-xpt
alexsandro-xpt / gist:3058488
Created July 6, 2012 06:50 — forked from millermedeiros/gist:3057782
Links sobre otimização de performance (WPO)
@alexsandro-xpt
alexsandro-xpt / Array.range.js
Created August 3, 2012 01:57 — forked from netojoaobatista/Array.range.js
ECMAScript 5 implementation of Python's range function
/**
* ECMAScript 5 implementation of Python's range function.
* @see {@link http://docs.python.org/release/1.5.1p1/tut/range.html}
* @param {Number} start
* @param {Number} end
* @param {Number} step
* @return {Array}
*/
Object.defineProperty(Array, "range", {
writable: false, configurable: false, enumerable: true,
@alexsandro-xpt
alexsandro-xpt / todo.php
Created September 28, 2012 03:17 — forked from alganet/todo.php
A very small PHP todo list that saves to the database in 32 lines
<?php
//The actual implementation is just this file. Others are usage and tests.
class TodoList extends ArrayObject
{
const CREATE = 'CREATE TABLE IF NOT EXISTS tasks (name VARCHAR(32) PRIMARY KEY, status INT)';
const SELECT = 'SELECT * FROM tasks';
const INSERT = 'INSERT INTO tasks VALUES (?,?)';
const UPDATE = 'UPDATE tasks SET status = ? WHERE name = ?';
@alexsandro-xpt
alexsandro-xpt / BusinessDaysTest.php
Created September 28, 2012 03:18 — forked from netojoaobatista/BusinessDaysTest.php
Algorítimo idiota (e caro) para cálculo de dias úteis entre duas datas.
<?php
require_once 'PHPUnit/Framework/TestCase.php';
require_once 'businessDays.php';
/**
* businessDays() test case.
*/
class BusinessDaysTest extends PHPUnit_Framework_TestCase {
protected function setUp() {
parent::setUp();

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

[IPFilter("192.168.0.0/24")]
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
}
#!/bin/bash
if [ $EUID != 0 ]; then
echo 'Você precisa ser root para instalar certificados.'
exit $?
fi
# Diretório onde os certificados serão instalados
cert_path=`openssl version -d|sed 's/.*\"\(.*\)\"/\1/g'`/certs
# Path para o certificado da Cielo
@alexsandro-xpt
alexsandro-xpt / gist:11a0e0b5f74c77bfb594
Last active September 11, 2015 14:20 — forked from ctolkien/gist:719c6ce5861c9155289c
ASP.Net 5 Gulp + Webpack
var gulp = require('gulp');
var webpack = require('gulp-webpack');
var ts = require('gulp-typescript');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var dnx = require("gulp-dnx");
gulp.task('webpack', function(){
return gulp.src('./src/client/main.ts')
.pipe(webpack({
output:{
@alexsandro-xpt
alexsandro-xpt / squash-commits.sh
Created February 29, 2016 15:33 — forked from jbub/squash-commits.sh
git squash last two commits into one
git rebase --interactive HEAD~2
# we are going to squash c into b
pick b76d157 b
pick a931ac7 c
# squash c into b
pick b76d157 b
s a931ac7 c