This file contains hidden or 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 | |
# app/models/TokenFilter.php | |
class TokenFilter { | |
public function filter() | |
{ | |
if(!Token::valid(Input::get('token'))) | |
{ |
This file contains hidden or 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 | |
/** | |
* SQL Injection and XSS attacks demonstrated | |
* | |
* Last modified : 5th June 2014 | |
*/ | |
$SAFE = TRUE; |
This file contains hidden or 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
// DatabaseFileManager.h | |
#import <Foundation/Foundation.h> | |
@interface DatabaseFileManager : NSObject | |
+ (void) manageFiles :(NSArray *) arrayOfDatabaseNames; | |
@end |
This file contains hidden or 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
# urls.py | |
urlpatterns += patterns('', | |
url(r'^platform$', views.platform_list, name='platform_list'), | |
url(r'^platform/new$', views.platform_create, name='platform_new'), | |
url(r'^platform/edit/(?P<pk>\d+)$', views.platform_update, name='platform_edit'), | |
url(r'^platform/delete/(?P<pk>\d+)$', views.platform_delete, name='platform_delete'), | |
) |
This file contains hidden or 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 get_bounds(gmaps_autocomplete_response) { | |
var lats = false, longs = false; | |
$.each(gmaps_autocomplete_response.geometry.viewport, function () { | |
if (!lats || !longs) { | |
var x,y = false; | |
var ref = false; | |
$.each(this, function () { | |
if (!x || !y) { | |
if (!x) x = this; | |
else y = this; |
This file contains hidden or 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
# service_helpers.py | |
def create_img_name(identifier): | |
return '%s%s%s' % (identifier, to_unix.to_unix(datetime.now()), randomstring.get_random_string()) | |
def get_params(obs, params, struct='dict'): | |
if struct == 'dict': | |
values = dict([ (param, obs.get(param)) for param in params if param in obs]) | |
else: | |
values = [(param, obs.get(param)) for param in params] |
This file contains hidden or 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
import socket | |
import select | |
PORT = 1002 | |
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
sock.bind(('0.0.0.0', PORT)) | |
while True: | |
package, w, x = select.select([sock], [], []) |
This file contains hidden or 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 config() | |
{ | |
cat ~/.ssh/config | while read line; do | |
if [[ $line == Host* ]];then | |
lline=$(echo $line| tr '[:upper:]' '[:lower:]') | |
if [ $# -eq 0 ];then | |
echo "$line" | |
echo "ssh ${line:5}" | pbcopy | |
elif [[ "${lline}" == *"$1"* ]];then | |
echo "$line" |
This file contains hidden or 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
$ sudo apt-get install ruby-bundler | |
# Gemfile | |
source :rubygems | |
gem 'rack' | |
$ bundler install | |
# config.ru | |
use Rack::Static, |