Skip to content

Instantly share code, notes, and snippets.

View pasviegas's full-sized avatar

Pedro Antonio Souza Viegas pasviegas

  • São Paulo, SP, Brazil
View GitHub Profile
@pasviegas
pasviegas / mongo_template.rb
Created January 6, 2010 10:57 — forked from banker/Rails MongoMapper Template.rb
working mongomapper rails template (jquery, cancan)
# mongo_template.rb
# fork of Ben Scofield's Rails MongoMapper Template (http://gist.github.com/181842)
#
# To use:
# rails project_name -m http://gist.github.com/270200.txt
# remove unneeded defaults
run "rm public/index.html"
run "rm public/images/rails.png"
@pasviegas
pasviegas / gist:345609
Created March 27, 2010 01:22
Setup for nginx server with proxy pass (possible load-balancing) and monit for nodejs web applications
We couldn’t find that file to show.
@pasviegas
pasviegas / mongodb
Created March 27, 2010 01:26
Simple monit script for mongodb
check host mongodb with address localhost
start program = "/usr/bin/sudo /opt/database/mongo/bin/mongod"
stop program = "/usr/bin/sudo /usr/bin/pkill -f mongod"
if failed port 28017 protocol HTTP
request /
with timeout 10 seconds
then start
Pacotes
- entidades - referente ao conjunto de atributos de uma abstraçao
- controladores - referente ao total de acoes de uma visao
- persistencia - refetente ao total de acoes no banco de dados
- logica de negocio - referente ao total de acoes de um caso de uso
- logica pura - referente ao total de operacoes em objetos primitivos, coleçoes ou wrappers
- visao - refetente a virtualizacao de parte de um caso de uso
- Persistencia
- recebe informacoes da logica de negocios
- Doc ready function -o
- Functional setting -w
- Chainable -w
- Classy dom -w
- Selector engine -o
- Element transformation -w
- Event management -o
- Intelligent ajax -w
- Templating -o
@pasviegas
pasviegas / svp.java
Created April 9, 2013 12:43
svn bindings
package br.org.pav.svp.old;
import java.io.File;
import java.io.IOException;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNNodeKind;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.io.ISVNEditor;
import org.tmatesoft.svn.core.io.SVNRepository;
@pasviegas
pasviegas / svphelper.java
Created April 9, 2013 12:44
svn bindings helper
package br.org.pav.svp.old;
import java.io.ByteArrayInputStream;
import java.io.File;
import org.tmatesoft.svn.core.SVNCommitInfo;
import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNErrorCode;
@pasviegas
pasviegas / core.clj
Created May 17, 2013 12:38
Reactor - Clojure
(ns reactor.clj.core
(:import [reactor.core Reactor Context]))
;;create the reactor
(def reactor (Reactor. (Context/rootDispatcher)))
;;create the selector
(def selector (reactor.Fn/$ "print.received"))
;;create and implement the consumer
(def consumer (proxy [reactor.fn.Consumer][] (accept [event] (println "Received"))))
(ns marsrover.core
(:require [clojure.string :as s]))
(defn add-tuple [fst snd]
[(+ (first fst) (first snd)) (+ (second fst) (second snd))])
(defn input->rovers [input]
(partition 2 (drop 1 (s/split-lines input))))
(defn next-movement [facing]
@pasviegas
pasviegas / MT.scala
Last active August 29, 2015 14:08 — forked from huitseeker/MT.scala
object MyApp{
trait ApplicativeFunctor[A, F[A]] {
def apply[X](a:X): F[X]
def map[B](f: A => B): F[B]
}
trait Monad[A, M[A]] extends ApplicativeFunctor[A, M] {
def flatMMap[B](f: A => M[B]): M[B]
}