Skip to content

Instantly share code, notes, and snippets.

View IgorDePaula's full-sized avatar
😆

Igor C. de Paula IgorDePaula

😆
View GitHub Profile
var moment = require('moment');
var inicio = moment().set({hours:'08',minutes:'00'});
var fim = moment().set({hours:'18',minutes:'00'});
for(var interval = inicio; interval < fim; interval.add({hours:1,minutes:30})){
console.log(interval.format('HH:mm'));
}
<?php
$datas = new DatePeriod(new DateTime('2015-01-30'), new DateInterval('P1M'), 10);
foreach ($datas as $data) {
echo $data->format('d/m/Y'), '<br>';
}
@sgnn7
sgnn7 / enable_mongo.sh
Created December 22, 2015 23:06
Mongodb 3.2 on Ubuntu 15.10
echo '[Unit]
Description=High-performance, schema-free document-oriented database
After=syslog.target network.target
[Service]
User=mongodb
Group=mongodb
ExecStart=/usr/bin/mongod -f /etc/mongod.conf
[Install]
@romuloctba
romuloctba / Esconder_console_log.md
Created April 12, 2016 20:32 — forked from fdaciuk/Esconder_console_log.md
Esconder console.log() quando o site for para produção

Esconder console.log() para o site em produção

  • Trocar o www.mywebsite.com pelo endereço do site em produção;
  • Incluir isso no início do seu script.

Se passar o parâmetro ?development na URL, ele ignora e mostra os console.log().

@bgromov
bgromov / git-reset-author.sh
Created June 23, 2016 17:50
Git: reset author for ALL commits
#!/bin/sh
# Credits: http://stackoverflow.com/a/750191
git filter-branch -f --env-filter "
GIT_AUTHOR_NAME='Newname'
GIT_AUTHOR_EMAIL='new@email'
GIT_COMMITTER_NAME='Newname'
GIT_COMMITTER_EMAIL='new@email'
" HEAD
@mattiaslundberg
mattiaslundberg / Ansible Let's Encrypt Nginx setup
Last active May 14, 2025 21:35
Let's Encrypt Nginx setup with Ansible
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
@wilcorrea
wilcorrea / uniqid.js
Last active February 15, 2017 11:57
Função do PHP uniqid em SQL e JS
// http://locutus.io/php/misc/uniqid/
function uniqid (prefix, moreEntropy) => {
if (typeof prefix === 'undefined') {
prefix = '';
}
let retId;
const _formatSeed = function (seed, reqWidth) {
seed = parseInt(seed, 10).toString(16); // to hex str
if (reqWidth < seed.length) {
@ebridges
ebridges / s3-playbook.yml
Last active June 7, 2021 16:30
Ansible playbook to generate one or more S3 buckets with permissions useful for rclone.
---
## Usage:
## ansible-playbook s3-playbook.yml
- hosts: localhost
connection: local
gather_facts: False
vars:
buckets:
'<BucketName>' : '<BucketARN>'
'com.example.bucket' : 'arn:aws:s3:::com.example.bucket'
@IgorDePaula
IgorDePaula / MainMenu.vue
Last active October 8, 2018 14:45
Menu recursivo em quasar (para drawer)
<template>
<div>
<q-collapsible v-if="item.children.length > 0" v-for="(item, index) in itens" :key="index" :icon="item.icon" indent :label="item.name"
:to="`/app/competitions/${item.id}`">
<main-menu :itens="item.children"/>
</q-collapsible>
<q-side-link :to="''" v-else >
<q-item>
<q-item-side :icon="item.icon"/>
<q-item-main :label="item.name"/>
@wilcorrea
wilcorrea / Controller.php
Last active February 15, 2018 01:43
Dicas & Truques em Orientação a Objetos: Ato I ~ Controller.php (usando a OO a seu favor)
<?php
namespace App\Http\Content\Controllers;
use App\Common\Model;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Routing\Controller;
/**