Skip to content

Instantly share code, notes, and snippets.

@Sigmus
Sigmus / gist:1944252
Created February 29, 2012 20:47
Doritos Sonár | Serviço galeria de vídeos
{
"status": 1,
"payload": [
{
"video_id": "3j3jg43j",
"video_type": "youtube",
"author": "Fulano da silva"
},
{
"video_id": "wejh484",
*View the [source of this content](http://github.github.com/github-flavored-markdown/sample_content.html).*
Oalo.
<?php
public static function updateDestaques()
{
$xml = simplexml_load_file(
Yii::app()->params['xml_destaques']
);
self::_updateFeed($xml);
<?php
abstract class Badge {
public $nome;
public $pontos;
abstract public function conforms();
private function __construct() {}
@Sigmus
Sigmus / gist:3789693
Created September 26, 2012 18:30
Dados Etapas
{
   "data": {
       "estados": [
           {
               "nome": "São Paulo",
               "ts": "2012-10-10",
               "status": "E",
               "x": 50,
               "y": 70
           },
@Sigmus
Sigmus / gist:3960659
Created October 26, 2012 18:49
Run scripts sequentially using map/reduce and jQuery
var files = [
'first.js',
'second.js',
'third.js',
'fourth.js'
];
var funcs = files.map(function(file) {
return function() { return $.getScript(file); }
});
@Sigmus
Sigmus / gist:3962012
Created October 26, 2012 22:48
Run scripts sequentially using pipe()
var files = [
'first.js',
'second.js',
'third.js',
'fourth.js'
];
var scriptsLoaded;
while( files.length ) {
var performers;
performers = {};
async.parallel([
function(callback) {
return conductor.find({}, function(err, result) {
performers.conductor = result;
return callback(err);
});
@Sigmus
Sigmus / gist:4068860
Created November 13, 2012 22:26
Share Facebook
function shareFacebook(title, summary, image, url) {
url = url || 'http://dev.digitalbox.cc/clientes/id-pernambucanas-natal2012/';
window.open('http://www.facebook.com/sharer.php?s=100&p[images][0]=' + image + '&p[url]=' + url + '&p[title]=' + title +' &p[summary]=' + summary);
}
$(function(){
$('[data-summary]').on('click', function(e){
e.preventDefault();
var $this = $(this),
@Sigmus
Sigmus / gist:4169419
Created November 29, 2012 14:23
Chars counter
$(function(){
charsCounter($('.texto'), $('.counter'), 400);
});
function charsCounter($input, $counter, max) {
$input.bind('keyup', update).bind('paste', update);
function update() {
var numChars = $input.val().length;
var remaining = max - numChars;