Skip to content

Instantly share code, notes, and snippets.

Avatar

Rogério Chaves rogeriochaves

View GitHub Profile
@rogeriochaves
rogeriochaves / gist:9625019
Created Mar 18, 2014
YDN-DB's IndexedDB vs Pure LocalStorage
View gist:9625019
I made this: http://jsperf.com/ydn-db-s-indexeddb-vs-pure-localstorage, check it out
@rogeriochaves
rogeriochaves / nfc_vcard.ino
Created Nov 6, 2014
Using Arduino Elechouse's NFC to create vCard
View nfc_vcard.ino
#if 0
#include <SPI.h>
#include <PN532_SPI.h>
#include <PN532.h>
#include <NfcAdapter.h>
PN532_SPI pn532spi(SPI, 10);
NfcAdapter nfc = NfcAdapter(pn532spi);
#else
@rogeriochaves
rogeriochaves / gist:937848ab4a5f383c2c6c
Created Mar 19, 2015
Testing RxJS Observables on Jasmine 1.3
View gist:937848ab4a5f383c2c6c
<script src="http://cdnjs.cloudflare.com/ajax/libs/rxjs/2.4.3/rx.all.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/rxjs/2.4.3/rx.testing.min.js"></script>
<script src="http://daniellmb.github.com/jasmine-run/jasmine-1.3.1-run.js"></script>
<script>
var waitsForObservable = function (observable, callback, opt_timeout) {
var result, timeout;
timeout = opt_timeout || 5000;
runs(function(){
@rogeriochaves
rogeriochaves / gist:4cb72f3306c0209800b1
Created Apr 28, 2015
Jasmine Pretty Printer when comparing objects
View gist:4cb72f3306c0209800b1
jasmine.MAX_PRETTY_PRINT_DEPTH = 3;
jasmine.pp = (function (j$) {
function PrettyPrinter() {
this.ppNestLevel_ = 0;
this.seen = [];
}
PrettyPrinter.prototype.format = function(value) {
this.ppNestLevel_++;
@rogeriochaves
rogeriochaves / rxclj.cljs
Created Apr 30, 2015
Comparing RxJS on javascript and clojurescript
View rxclj.cljs
(ns rxjsclj.core
(:require [Rx]))
(defn stream-for [x]
(.map (.interval js/Rx.Observable 2000) x))
(def providers (.from js/Rx.Observable [1 2 3]))
(-> (stream-for providers)
(.concatMap #(.map % stream-for))
View gist:2410887
<div id="window_drive" class="abs window">
<div class="abs window_inner">
<div class="window_top">
<span class="float_left">
<img src="assets/images/icons/icon_16_drive.png" />
Alunos
</span>
<span class="float_right">
<a href="#" class="window_min"></a>
<a href="#" class="window_resize"></a>
@rogeriochaves
rogeriochaves / main.hs
Created Nov 22, 2015
Contacts Program in Haskell
View main.hs
import Data.List
main = do
putStrLn "Welcome to the contacts list program!"
mainMenu [] -- initial contacts list state
mainMenu :: [String] -> IO b
mainMenu contacts = do
putStrLn "1 - Add new contacts; 2 - Show contacts; 3 - Sort contacts"
View gist:ad633f47dab497a84ad0
(function (originalOpen) {
XMLHttpRequest.prototype.open = function (method, url, async, user, password) {
if (url.match(/limits/)) url = "REJECTED";
originalOpen.call(this, method, url, async, user, password);
};
})(XMLHttpRequest.prototype.open);
@rogeriochaves
rogeriochaves / gist:4552752
Created Jan 17, 2013
Just trying to simulate jquery like methods binding with ruby
View gist:4552752
class JQuery
class << self
attr_accessor :thread
end
def self.get(url, &block)
block.call("resposta")
return self
end
@rogeriochaves
rogeriochaves / quadrados.css
Created May 22, 2013
CSS do jogo quadrados
View quadrados.css
/* CSS declarations go here */
.quadrado{
width:50px; height:50px; background:#F00; position: absolute;
}