Skip to content

Instantly share code, notes, and snippets.


Rami GB ramigb

View GitHub Profile
ramigb / TwitterBootstrap RTL Fixes
Created May 12, 2012
my twitter bootstrap RTL fixes, it's a bit ugly, but so far it works.
View TwitterBootstrap RTL Fixes
/*RTL support to tabs*/
.nav-tabs > li, .nav-pills > li
/*RTL support to DL*/
.dl-horizontal dt {
float: right;
width: 120px;
ramigb / gist:5473469
Created Apr 27, 2013
Get Rake routes in the browser
View gist:5473469
def rts
r = %x( rake routes )
render :inline => "<pre>#{r}</pre>"
ramigb / gist:7854548
Last active Dec 30, 2015
Pagination - Get limit and offset
View gist:7854548
function page($page,$limit){
if($page == 0 ){
return 0;
}elseif ($page == 1){
return $limit;
if($limit == 1){
return $page * $limit;
return ($page * $limit) - $limit;
ramigb / gist:8217446
Created Jan 2, 2014
Reset voting counts
View gist:8217446
UPDATE `votes_items` c
SELECT `vote_id`, COUNT(`vote_id`) as total
FROM `votes`
GROUP BY `vote_id`
) x ON = x.vote_id
SET c.votes_counter =
View gist:51fe1df3d0eb685abab1
#!/usr/bin/env ruby
require 'net/http'
require 'json'
def http_get(url)
puts "http_get: #{url}"
return Net::HTTP.get(URI(url))
def handle_http(response, url)
ramigb / MY_Security.php
Created Oct 11, 2015 — forked from CMCDragonkai/MY_Security.php
PHP: Codeigniter CSRF functionality does not support putting the CSRF token in the HTTP headers for the purposes of the double submit cookie method. It also only runs the CSRF check on POST and not on PUT or DELETE. This drop in MY_Security.php makes sure CSRF runs on POST, PUT or DELETE and checks the HTTP headers for X-XSRF-TOKEN recommended b…
View MY_Security.php
class MY_Security extends CI_Security{
//overriding the normal csrf_verify, this gets automatically called in the Input library's constructor
//verifying on POST and PUT and DELETE
public function csrf_verify(){
$request_method = strtoupper($_SERVER['REQUEST_METHOD']);