Skip to content

Instantly share code, notes, and snippets.


Igor C. de Paula IgorDePaula

View GitHub Profile
View soma_dias_uteis.php
$diasParaSomar = 10;
$dataFinal = new DateTime('now');
while ($diasParaSomar) {
$dataFinal = $dataFinal->add(new DateInterval('P1D'));
if (in_array($dataFinal->format('w'), array(0,6))) {
View gist:bb8a16815f16d488eba5

Keybase proof

I hereby claim:

  • I am IgorDePaula on github.
  • I am borodin ( on keybase.
  • I have a public key whose fingerprint is 8750 5CC1 0134 676D BCE6 5C0D 06FB 070B E19C D14F

To claim this, I am signing this object:

View Mongoose GridFS
mongoose = require('mongoose');
var GridStore = mongoose.mongo.GridStore,
Grid = mongoose.mongo.Grid,
ObjectID = mongoose.mongo.BSONPure.ObjectID;
exports.getGridFile = function(id, fn) {
var db = mongoose.connection.db,
id = new ObjectID(id),
View node-express-cors-middleware.js
// ## CORS middleware
// see:
var allowCrossDomain = function(req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization');

This example demonstrates how to display the progress of an asynchronous request. Rather than saying d3.json(url, callback), use d3.json(url) to first create the request object, then register a "progress" event listener with xhr.on before starting the request with xhr.get.

You can also use this pattern to listen to "load" and "success" events separately. For example:

var xhr = d3.json(url)
    .on("progress", function() { console.log("progress", d3.event.loaded); })
    .on("load", function(json) { console.log("success!", json); })
    .on("error", function(error) { console.log("failure!", error); })
View load progress with d3
<!DOCTYPE html>
<script src=""></script>
.progress-meter .background {
fill: #ccc;
View D3 Gantt
<div id = "container">
<div class = "svg"></div>
<div id = "tag"></div>
* {
margin: 0;
padding: 0;
View vhost-apache
###Checking for user
if [ "$(whoami)" != 'root' ]; then
echo "You have no permission to run $0 as non-root user. Use sudo !!!"
exit 1
###Configure emil and vhost dir
IgorDePaula / install_a_component_by_composer.php
Last active Dec 16, 2020
Codigo que atualizar o composer.json e instala o novo compoente atraves de uma pagina em php
View install_a_component_by_composer.php
// componentes requeridos
// composer/composer
// symfony/console
// classes requeridas
// use Composer\Command\UpdateCommand;
// use Symfony\Component\Console\Input\ArrayInput;
// use Composer\Console\Application;
View jobs.js
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
* unoconv -f pdf -o ' + path1 + '.pdf ' + path1
var kue = require('kue')
, jobs = kue.createQueue();
var exec = require('child_process').exec;