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
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) ->
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()
@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 = ''
@tarolandia
tarolandia / steps
Created May 5, 2013 02:30
Disable sync flag when mounting an External HDD to your raspberry pi (xBian)
sudo vi /etc/usbnount/usbmount.conf
...
MOUNTOPTIONS="sync,noexec,nodev,noatime,nodiratime,rw"
...
remove sync flag and save the file
...
@tarolandia
tarolandia / placeholder-color.sass
Created April 22, 2013 12:33
Sass: mixin that let you change placeholder font color.
@mixin placeholder-color($color) {
&::-webkit-input-placeholder { /* WebKit browsers */
color: $color;
}
&:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
color: $color;
}
&::-moz-placeholder { /* Mozilla Firefox 19+ */
color: $color;
}
<?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 / 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."}
@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',
foreach($values as $key=>$val) {
if (!isset($values[$key])) {
unset($values[$key]);
}
}
@tarolandia
tarolandia / tst.rb
Created June 29, 2012 18:48
Sinatra app
#GET http://0.0.0.0:4567/thumb/https%3a%2f%2ftwimg0-a.akamaihd.net%2fprofile_images%2f1615677010%2f34214a75-4b21-46ae-89b4-2e44e356dc92_normal.png
#Sinatra doesn’t know this ditty.
#Try this:
#get '/thumb/https%3a/twimg0-a.akamaihd.net/profile_images/1615677010/34214a75-4b21-46ae-89b4-2e44e356dc92_normal.png' #do
# "Hello World"
#end
require 'sinatra'