Here are some things I have learned along the way.
Last Updated: 2013-02-08
Original Audience: Hack Reactor
-- split a string | |
function string:split(delimiter) | |
local result = { } | |
local from = 1 | |
local delim_from, delim_to = string.find( self, delimiter, from ) | |
while delim_from do | |
table.insert( result, string.sub( self, from , delim_from-1 ) ) | |
from = delim_to + 1 | |
delim_from, delim_to = string.find( self, delimiter, from ) | |
end |
select concat(substr(cpf, 1, 3), '.', substr(cpf, 4, 3), '.', substr(cpf, 7, 3), '-', first_dig, if(second_soma % 11 < 2, 0, 11 - (second_soma % 11))) AS cpf | |
from ( | |
select cpf, first_dig, second_one+second_two+second_three+second_four+second_five+second_six+second_seven+second_eight+second_nine+second_ten AS second_soma | |
from ( | |
select | |
cpf, | |
11*original_one AS second_one, | |
10*original_two AS second_two, | |
9*original_three AS second_three, | |
8*original_four AS second_four, |
class API::V1::BaseController < ApplicationController | |
skip_before_filter :verify_authenticity_token | |
before_filter :cors_preflight_check | |
after_filter :cors_set_access_control_headers | |
def cors_set_access_control_headers | |
headers['Access-Control-Allow-Origin'] = '*' | |
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS' |
// json is a JSON atlas generated by TexturePacker | |
// imagepath is a url to the full texture atlas image | |
var atlasTexture = THREE.ImageUtils.loadTexture( imagepath, undefined, function() { | |
for (var key in json.frames) { | |
var tex = atlasTexture.clone(); | |
var frame = json.frames[key].frame; | |
tex.repeat.x = ( frame.w / atlasTexture.image.width ); |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<h2>Original CSS</h2> | |
<style style="display: block; white-space: pre; font-family: monospace"> | |
h2 { margin:0; } |
Here are some things I have learned along the way.
Last Updated: 2013-02-08
Original Audience: Hack Reactor
http://estelle.github.com/mobileperf/#slide55 | |
https://github.com/impressiver/velocity2012 | |
https://github.com/jonlives/velocity_resources | |
Chef - Jon Cowie (Etsy) | |
Ele tem um handler que consegue mandar o que falha para or irc usando |
-- PostgreSQL 9.2 beta (for the new JSON datatype) | |
-- You can actually use an earlier version and a TEXT type too | |
-- PL/V8 http://code.google.com/p/plv8js/wiki/PLV8 | |
-- Inspired by | |
-- http://people.planetpostgresql.org/andrew/index.php?/archives/249-Using-PLV8-to-index-JSON.html | |
-- http://ssql-pgaustin.herokuapp.com/#1 | |
-- JSON Types need to be mapped into corresponding PG types | |
-- |
var p1 = { | |
x: 20, | |
y: 20 | |
}; | |
var p2 = { | |
x: 40, | |
y: 40 | |
}; |