This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE `votes_items` c | |
INNER JOIN ( | |
SELECT `vote_id`, COUNT(`vote_id`) as total | |
FROM `votes` | |
GROUP BY `vote_id` | |
) x ON c.id = x.vote_id | |
SET c.votes_counter = x.total |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function page($page,$limit){ | |
if($page == 0 ){ | |
return 0; | |
}elseif ($page == 1){ | |
return $limit; | |
}else{ | |
if($limit == 1){ | |
return $page * $limit; | |
}else{ | |
return ($page * $limit) - $limit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def rts | |
r = %x( rake routes ) | |
render :inline => "<pre>#{r}</pre>" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*RTL support to tabs*/ | |
.nav-tabs > li, .nav-pills > li | |
{ | |
float:right; | |
} | |
/*RTL support to DL*/ | |
.dl-horizontal dt { | |
float: right; | |
width: 120px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'net/http' | |
require 'json' | |
def http_get(url) | |
puts "http_get: #{url}" | |
return Net::HTTP.get(URI(url)) | |
end | |
def handle_http(response, url) |