Skip to content

Instantly share code, notes, and snippets.

View EvertonSilva's full-sized avatar

Everton Silva EvertonSilva

  • Muralis Tecnologia
  • Mogi das Cruzes - SP
  • 17:33 (UTC -03:00)
  • X @_evertonsilva
View GitHub Profile
@EvertonSilva
EvertonSilva / gist:5916980
Created July 3, 2013 10:47 — forked from jmertic/gist:5847575
Interacting with the new RESTful Sugar Web Services in Node.js
var sys = require('util'),
rest = require('restler');
var baseurl = "<<instance URL>>/rest/v10"
// get oAuth token
var jsonData = {"grant_type":"password","username":"<<username>>","password":"<<password>>","client_id":"sugar"};
rest.postJson(baseurl+'/oauth2/token', jsonData).on('2XX', function(data) {
if ( data.error ) {
sys.puts("Error: " + data.error_message);
@EvertonSilva
EvertonSilva / random_str.rb
Created November 7, 2013 12:42
Generate a "random" string in ruby
rand_str = ('a'..'z').to_a
('A'..'Z').to_a.each { |i| rand_str.push(i) }
9.downto(0) { |n| rand_str.push(n) }
rand_str.shuffle[0..9].join
@EvertonSilva
EvertonSilva / gistIO.md
Last active August 29, 2015 13:56
Testando o Gist.io

GitHub pode ser o seu (micro)blog

Acabei de descobrir o Gist.io, um serviço que permite compartilhar conteúdo de maneira bem peculiar, sem registro, sem burocracia, se você tiver uma conta no GitHub já está pronto para começar. A ideia é bem simples crie um gist público no GitHub, adicione qualquer conteúdo utilizando Markdown salve e pronto! Para visualizar e compartilhar seu post basta utilizar a seguinte url gist.io/ID-do-seu-gist

<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
function enqueue_my_styles() {
global $wp_styles;
// Load the main stylesheet
wp_enqueue_style( 'my-theme', get_stylesheet_uri() );
@EvertonSilva
EvertonSilva / linkedList.js
Last active August 29, 2015 14:25
Convert an Array in a Linked List Object
/**
* Solution to exercise 4.3
* from Eloquent JavaScript Book,
* Chapter 4 - Exercise 4.3
*
* http://eloquentjavascript.net/04_data.html
*/
function arrayToList(arr) {
var list = null;
Tux,
Git,
Apache Web Server,
MySQL,
Gnome,
Gnu,
Firefox,
KDE,
Blender,
X.Org,
@EvertonSilva
EvertonSilva / nginx.default.conf
Created July 9, 2016 04:35 — forked from sumardi/nginx.default.conf
Install PHP-FPM, Nginx & MySQL on EC2 with Amazon Linux AMI
# Install linux update, followed by GCC and Make
sudo yum -y update
sudo yum install -y gcc make
# Install Nginx and PHP-FPM
sudo yum install -y nginx php-fpm
# Install PHP extensions
sudo yum install -y php-devel php-mysql php-pdo \
php-pear php-mbstring php-cli php-odbc \
@EvertonSilva
EvertonSilva / contact.haml
Created January 28, 2017 00:45 — forked from wavesummit/contact.haml
An example sinatra app that uses pony and gmail to send an e-mail
.grid_12
%h1 Contact
%h2 Want to get in contact, have a question or just fancy a chat?
%p Fill out the form below
%form{:action => "/contact", :method => "post"}
%div{:style => "margin:0;padding:0;display:inline"}
%label{:for => "contact_subject"} Subject:
%br
%input#contact_subject{:name => "subject", :size => "30", :type => "text"}/
@EvertonSilva
EvertonSilva / curl_post_to_rails.md
Last active February 11, 2018 20:05
Send curl POST to rails app

Make a POST request to Rails App using curl

1. Make a GET request to get a csrf token

curl http://exemplo.com.br --cookie-jar cookie | grep csrf

The --cookie-jar option creates a cookie in a file called "cookie" xD. This cookie is needed to validate the POST request

The command above will output something like this

@EvertonSilva
EvertonSilva / run_git-daemon.sh
Created March 10, 2017 17:58
Start git-daemon
# Start git-daemon to make local repositories available through network.
# see: https://www.kernel.org/pub/software/scm/git/docs/git-daemon.html
git daemon --verbose --export-all --base-path=/path/to/RepoSuperFolder