Skip to content

Instantly share code, notes, and snippets.

View diegoponciano's full-sized avatar
🏠
Working from home

Diego Ponciano diegoponciano

🏠
Working from home
  • Sao Paulo - Brazil
View GitHub Profile
http://jsbin.com/ojija/3
http://bit.ly/inverte
String.prototype.reverse=function(){return this.split("").reverse().join("");}
function reverse(s){
return s.split("").reverse().join("");
}
$(document).ready(function () {
$("#inverteTexto").click(function(){
//var textoInvertido = reverse($("#texto").val());
By Klaus Wuestefeld
1) Torne-se excelente.
Seja realmente bom em alguma coisa. Não fique só choramingando ou
querendo progredir às custas dos outros. Não pense q pq vc sentou 4
anos numa faculdade ouvindo um professor falar sobre software q vc
sabe alguma coisa. Jogador de futebol não aprende a jogar bola tendo
aula. Ele pratica. Instrumentistas geniais nao aprendem a tocar tendo
aula. Eles praticam. Pratique. Chegue em casa depois do trabalho e da
@diegoponciano
diegoponciano / Input.js
Created May 5, 2011 19:10
input controls
var gamejs = require('gamejs');
exports.UserControls = function(size, sticker) {
this.size = size;
this.sticker = sticker;
this.left = false;
this.right = false;
this.paused = false;
this.initialClick = false;
@diegoponciano
diegoponciano / mainwindow.ui
Created October 26, 2011 22:32
QWidget won't apply background-color through setStyleSheet using PySide
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>661</width>
<height>487</height>
@diegoponciano
diegoponciano / gist:1514313
Created December 23, 2011 14:12 — forked from sontek/snowjob.sh
Make your terminal snow
#!/bin/bash
LINES=$(tput lines)
COLUMNS=$(tput cols)
declare -A snowflakes
declare -A lastflakes
clear
$(document).ready(function(){
persistence.store.websql.config(persistence, 'persistencetest', 'My db', 5 * 1024 * 1024);
var Project = persistence.define('Project', {
name: "TEXT"
});
var Task = persistence.define('Task', {
name: "TEXT",
done: "BOOL"
@diegoponciano
diegoponciano / pog-access-json.js
Created April 18, 2012 17:25
pog pra acessar as propriedades de um json estranho da "firma"
json = {/*json object with lots of properties*/};
var strings = [];
for (var jsonProp in json) {
if (json.hasOwnProperty(jsonProp)) {
jsonObj = json[jsonProp];
for (var i=0; i<jsonObj.length; i++) {
if(typeof(jsonObj[i]) === 'string'){
strings.push(jsonObj[i]);
}
// Released under MIT license: http://www.opensource.org/licenses/mit-license.php
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);
# html template
{% form_from_page slug %}
# template tag
from mezzanine import template
from mezzanine.forms.forms import FormForForm
from mezzanine.pages.models import Page
register = template.Library()
do $$
declare
seq_name text;
tbl information_schema.tables%rowtype;
tables CURSOR FOR SELECT tablename FROM pg_tables WHERE schemaname = 'public' ORDER BY tablename;
begin
FOR table_record IN tables LOOP
seq_name = table_record.tablename || '_id_seq';
-- tests if a sequence with this name already exists
IF EXISTS (SELECT 0 FROM pg_class where relname = seq_name)