Skip to content

Instantly share code, notes, and snippets.

View silasrm's full-sized avatar

Silas Ribas Martins silasrm

View GitHub Profile
@silasrm
silasrm / install.sh
Created June 1, 2016 23:49 — forked from solar/install.sh
install redis with supervisord
#!/bin/sh
version="2.6.3"
priority="20603"
sudo mkdir -p /var/redis /var/log/redis
curl -sL http://redis.googlecode.com/files/redis-${version}.tar.gz | tar zx
cd redis-${version}/
make
sudo make PREFIX=/usr/local/redis/${version} install
@silasrm
silasrm / mongo-autostart-osx.md
Created June 30, 2016 02:39 — forked from subfuzion/mongo-autostart-osx.md
mongo auto start on OS X

Install with Homebrew

brew install mongodb

Set up launchctl to auto start mongod

$ ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents

/usr/local/opt/mongodb/ is a symlink to /usr/local/Cellar/mongodb/x.y.z (e.g., 2.4.9)

@silasrm
silasrm / pdf.py
Last active July 16, 2016 12:05
Generate many pdf files using a tuple of filename
from fpdf import FPDF
import re
import os
"""
Generate many files based on a tuple of data for sample.
@gist https://gist.github.com/silasrm/ff4733ecfa6bf1c6782c3513b89f10c4
@version 0.1
"""
@silasrm
silasrm / nginx.conf
Created July 22, 2016 05:07 — forked from atma/nginx.conf
Nginx + nodejs + socket.io websockets
# Add to nginx.conf http section
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
@silasrm
silasrm / git-change-commit-messages.md
Created July 24, 2016 20:06 — forked from nepsilon/git-change-commit-messages.md
How to change your commit messages in Git? — First published in fullweb.io issue #55

How to change your commit messages in Git?

At some point you’ll find yourself in a situation where you need edit a commit message. That commit might already be pushed or not, be the most recent or burried below 10 other commits, but fear not, git has your back 🙂.

Not pushed + most recent commit:

git commit --amend

This will open your $EDITOR and let you change the message. Continue with your usual git push origin master.

@silasrm
silasrm / install-comodo-ssl-cert-for-nginx.rst
Created September 22, 2016 04:55 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@silasrm
silasrm / jquery.parseparams.js
Created October 13, 2016 22:21 — forked from kares/jquery.parseparams.js
jQuery.parseParams - parse query string paramaters into an object
/**
* $.parseParams - parse query string paramaters into an object.
*/
(function($) {
var re = /([^&=]+)=?([^&]*)/g;
var decodeRE = /\+/g; // Regex for replacing addition symbol with a space
var decode = function (str) {return decodeURIComponent( str.replace(decodeRE, " ") );};
$.parseParams = function(query) {
var params = {}, e;
while ( e = re.exec(query) ) {
<?php
public function buscaParceiro(Request $request){
$string = $request->get('pesquisa');
$parceiro = DB::table('usuario')
->join('pessoa', 'pessoa.filho_id', '=', 'usuario.id')
->where('usuario.filho_type', '=', "'CompraSerrana\Parceiro'")
->where('pessoa.nome', 'LIKE', "%$string%")
->get();
<?php
/*
Plugin Name: bbPress - Custom KSES Allowed Tags
Plugin URI: https://gist.github.com/ntwb/7797990
Description: bbPress - Custom KSES Allowed Tags
Version: 0.2
Author: Stephen Edgar - Netweb
Author URI: http://netweb.com.au
*/
@silasrm
silasrm / blink.css
Created February 25, 2017 19:44 — forked from mugifly/blink.css
CSS Blink for Webkit and others. (Chrome, Safari, Firefox (Gecko), IE, ...) CSSで擬似的なblinkを再現する簡単なTips。