Skip to content

Instantly share code, notes, and snippets.

<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 / gist:4552752
Created January 17, 2013 01:29
Just trying to simulate jquery like methods binding with ruby
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 15:49
CSS do jogo quadrados
/* CSS declarations go here */
.quadrado{
width:50px; height:50px; background:#F00; position: absolute;
}
@rogeriochaves
rogeriochaves / quadrados.js
Created May 22, 2013 15:51
JavaScript do jogo Quadrados
Quadrados = new Meteor.Collection("quadrados");
if (Meteor.isClient) {
Template.quadrados.quadrados = function () {
return Quadrados.find({});
};
Meteor.startup(function () {
var quadrado = Quadrados.insert({x: Math.random() * 500, y: Math.random() * 500});
Session.set("quadrado", quadrado);
@rogeriochaves
rogeriochaves / quadrados.html
Created May 22, 2013 15:52
HTML do jogo quadrados
<head>
<title>quadrados</title>
</head>
<body>
{{> quadrados}}
</body>
<template name="quadrados">
{{#each quadrados}}
@rogeriochaves
rogeriochaves / gist:6175461
Created August 7, 2013 16:03
Qual Cache do Rails utilizar para melhorar (muito) a performance server-side
Page Cache:
- Quando todos os usuários verão exatamente a mesma página, ao mesmo tempo, e quando é uma página que não muda muito
Action Cache:
- Quando houver código para ser executado antes da action (ex.: Autenticação)
- Porém os resultados das páginas serão os mesmos
Fragment Cache:
- Quando a página for diferente para cada usuário
- Porém partes da página forem a mesma para diversos usuários
@rogeriochaves
rogeriochaves / gist:9625019
Created March 18, 2014 17:31
YDN-DB's IndexedDB vs Pure LocalStorage
I made this: http://jsperf.com/ydn-db-s-indexeddb-vs-pure-localstorage, check it out
@rogeriochaves
rogeriochaves / nfc_vcard.ino
Created November 6, 2014 12:44
Using Arduino Elechouse's NFC to create vCard
#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 March 19, 2015 22:07
Testing RxJS Observables on Jasmine 1.3
<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 April 28, 2015 03:02
Jasmine Pretty Printer when comparing objects
jasmine.MAX_PRETTY_PRINT_DEPTH = 3;
jasmine.pp = (function (j$) {
function PrettyPrinter() {
this.ppNestLevel_ = 0;
this.seen = [];
}
PrettyPrinter.prototype.format = function(value) {
this.ppNestLevel_++;