Skip to content

Instantly share code, notes, and snippets.

View sergiors's full-sized avatar
🎯
Focusing

Sérgio R Siqueira sergiors

🎯
Focusing
View GitHub Profile
var fs = require("fs");
module.exports = {
play: function(req, res) {
var path = "video.mp4";
var stat = fs.statSync(path);
var total = stat.size;
if (req.headers["range"]) {
var range = req.headers.range;
@sergiors
sergiors / gulpfile.js
Created January 13, 2015 23:49
React Task
var gulp = require('gulp')
, source = require('vinyl-source-stream')
, browserify = require('browserify')
, reactify = require('reactify')
gulp.task('bundle', function() {
browserify({
entries: ['./public/scripts/dd/bootstrap.js'],
transform: ['reactify']
})
@sergiors
sergiors / gist:75bbadcece53ed89f632
Last active August 29, 2015 14:20
symfony form
class User extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', 'text')
->add('email', 'email')
->add('password', 'password');
}
@sergiors
sergiors / gist:54b8f042bed1f0adc007
Last active August 29, 2015 14:21
Patch to work with Flux at Backbone
_.each(['Collection'], function(name) {
var collection = Backbone[name];
collection.prototype.addChangeListener = function(callback) {
this.on('all', callback)
}
collection.prototype.removeChangeListener = function(callback) {
this.off('all', callback);
}
var User = (function() {
'use strict';
var user = {};
function User(attrs) {
user.profile = attrs.profile || {};
user.address = attrs.address || {};
user.payments = attrs.payments || {};
}
@sergiors
sergiors / fetch.js
Created May 20, 2015 14:28
fetch event
_.each(['Model', 'Collection'], function(name) {
var ctor = Backbone[name];
var fetch = ctor.prototype.fetch;
ctor.prototype.fetch = function() {
this.trigger('fetch', this);
return fetch.apply(this, arguments);
}
});
// before
var fib = function(n) {
if (n <= 1) {
return n;
}
else {
return fib(n - 1) + fib(n - 1);
}
};
define(function(require) {
'use strict';
var React = require('react');
var dom = React.DOM;
return React.createClass({
propTypes: {
onClose: React.PropTypes.func.isRequired
},
// see before https://github.com/sergiors/vanilla
(function() {
'use strict';
var state = document.getElementById('address_state');
state.on('change', function() {
var city = document.getElementById('address_city');
city.setAttribute('disabled', true);
<?php
namespace Inbep\Doctrine\Query\PostgreSql;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
class JsonbHashGreaterGreater extends FunctionNode
{