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:28 (UTC -03:00)
  • X @_evertonsilva
View GitHub Profile
@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 / 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);