Skip to content

Instantly share code, notes, and snippets.

View tarolandia's full-sized avatar

Lautaro Orazi tarolandia

  • Theorem LLC
  • Valencia, Spain
View GitHub Profile
@tarolandia
tarolandia / test.rb
Created October 31, 2012 12:22
Testing create action
require 'spec_helper'
describe UsersController do
describe "User creation" do
it "should create a new user" do
@user = mock_model(User,
:email => 'test@gmail.com',
:password => 'test',
:name => 'tester',
@tarolandia
tarolandia / mandrill.rb
Created November 2, 2012 15:09
Mandrill API error very useful :/
req = Net::HTTP::Post.new('/api/1.0/messages/send.json', initheader = {'Content-Type' =>'application/json'})
req.body = @request.to_json
http = Net::HTTP.new(@uri.host, @uri.port)
http.use_ssl = true
response = http.start {|http| http.request(req) }
puts "Response #{response.code} #{response.message}: #{response.body}"
# => Response 500 Internal Server Error: {"status":"error","code":-100,"name":"GeneralError","message":"An unknown error occurred processing your request. Please try again later."}
<?php
$con = mysql_connect("web02.sjc.netdna.com", "devel", "n3tdn@");
if (!$con) die('Could not connect: ' . mysql_error());
mysql_select_db("clients_test", $con);
// MUST Consider 100TB packages
@tarolandia
tarolandia / mandrilapi.rb
Created May 28, 2013 19:58
Postman Mandril API adapter
require "net/http"
require "uri"
require "json"
module Postman
class MandrilAPI
@key = ''
@request = {}
@uri = ''
window.init_scrollbars = (pane, scrollbar) ->
content = pane.find(".conversation-scroll-content")
if pane.height() > content.height()
scrollbar.css("opacity", "0.3")
else
scrollbar.draggable({
containment: "parent",
axis: 'y',
drag: (event, ui) ->
scrollbar_height = scrollbar.parent().height() - scrollbar.height()
window.init_scrollbars = (pane, scrollbar) ->
content = pane.find(".conversation-scroll-content")
if pane.height() > content.height()
scrollbar.css("opacity", "0.3")
else
scrollbar_height = scrollbar.parent().height() - scrollbar.height()
scrollbar.draggable({
containment: "parent",
axis: 'y',
drag: (event, ui) ->
class Group
include Ripple::Document
include Ripple::Encryption
property :name, String, :presence => true
property :user_id, String, :presence => true, :index => true
timestamps!
one :owner, class_name: 'User', foreign_key: :user_id
@tarolandia
tarolandia / sdd_vs_hdd
Created July 24, 2013 16:17
SDD vs HDD
#### SDD
* Dual-Core I7
* 8GB RAM
Finished in 4 minutes 57.1 seconds
542 examples, 0 failures
#### HDD (5400)
class Player
@health = 20
@bottom = false
@pivot = false
@last_mode = nil
@last_move = nil
@mode = :walk
@move = :backward
@fullrecover = false
irb(main):001:0> Application.find("mapmyfitness")
=> <Application:mapmyfitness flags={} has_icon=false created_at=2012-11-12 23:09:35 UTC app_type="browser" app_status="dev" scope_permissions="public" default_access_type="read_write" connected_apps=0 total_users=5 state="inactive" name="mapmyfitness" prod_activated_at=nil display_name="mapmyfitness" description="MapMyFitness Connector" url_website=nil url_support="http://mhealth.dev.attcompute.com" consumer_id="T43czemeRxRRoHHEQOau" consumer_secret="FW2m75YgHkuR2wnwwI8VpDKYDnJK63dns6yKRyAg" updated_at=2013-09-12 19:30:03 UTC developer_id=nil organization=nil compliance=nil url_subscription=nil url_callback=nil>