Skip to content

Instantly share code, notes, and snippets.

View nailton's full-sized avatar

Nailton nailton

View GitHub Profile
<?php
$cURL = curl_init('http://www.exemplo.com.br/enviaPost.php');
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
$post = array(
'nome' => 'Renan Martins Pimentel',
'email' => 'contato@renanmpimentel.com.br',
'mensagem' => 'Agora eu sei usar o cURL, demais!'
);
#!/usr/bin/env ruby
require 'gosu' # gem install gosu --no-document
include Gosu
$dimension, $splits = 200, 20
$size = $dimension.to_f / $splits.to_f
class Worm
attr_writer :dir
def initialize() reset end
@nailton
nailton / insertMultiSQL.php
Last active August 29, 2015 14:05 — forked from anonymous/insertMulti.php
Instead of using a loop, you can combine the data into a single database query.
<?php
$userData = array();
foreach ($userList as $user) {
$userData[] = '("' . $user['first_name'] . '", "' . $user['last_name'] . '")';
}
$query = 'INSERT INTO users (first_name,last_name) VALUES' . implode(',', $userData);
mysql_query($query);
<?php # -*- coding: utf-8 -*-
// function remove_accents()
/**
* Unaccent the input string string. An example string like `ÀØėÿᾜὨζὅБю`
* will be translated to `AOeyIOzoBY`. More complete than :
* strtr( (string)$str,
* "ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ",
* "aaaaaaaaaaaaooooooooooooeeeeeeeecciiiiiiiiuuuuuuuuynn" );
*
# Local Dates:
git log --date=local --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.local.tsv.txt
# ISO Dates:
git log --date=iso --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.iso.tsv.txt
#!/bin/sh
# Sublime Text 3 install with Package Control (last update: 4 April 2015)
#
# No need to download this script, just run it on your terminal:
#
# $ curl -L git.io/sublimetext | sh
#
# When you need to update Sublime Text, run this script again.
<?php
# Load slim WP
define( 'WP_USE_THEMES', false );
require( './wp-load.php' );
# http://phpexcel.codeplex.com/
require_once dirname(__FILE__) . '/Classes/PHPExcel.php';
global $wpdb;
$query = "SELECT * FROM $wpdb->comments
@nailton
nailton / .htaccess
Created December 18, 2015 19:54 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@nailton
nailton / 1_passo.md
Created January 3, 2016 16:52 — forked from 3runoDesign/Procfile
Deploy Heroku [Laravel 5.1]

#Deploy Heroku - Laravel 5.1 Tive alguns problemas ao tentar fazer o deploy ao Heroku, para mais detalhes vejam esse post Deployment broken when upgrading to Laravel 5.1.

Criando projeto Laravel

Caso você esteja criando um projeto do zero utilize via Laravel Installer:

laravel new nome_app
@nailton
nailton / 0_reuse_code.js
Created February 12, 2016 11:02
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console