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
<? | |
class confirm_code | |
{ | |
protected static function generate_random_bytes($length=16){ | |
if(function_exists('openssl_random_pseudo_bytes')) { | |
$rnd = openssl_random_pseudo_bytes($length, $strong); | |
if ($strong === TRUE) | |
return $rnd; | |
} |
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 node | |
var fs = require('fs'); | |
var moment = require('moment'); | |
if (!!~process.argv.indexOf('-p') && process.argv.length === 4) | |
parseLog(process.argv[3]); | |
else if (!!~process.argv.indexOf('-d')) { | |
var infile = (process.argv.length > 3) ? process.argv[3] : null; | |
dailyAverages(infile); | |
} |
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
var fullWidth = 290 | |
var numberOfElements = 7 | |
var positionOffset = 0 | |
process.argv.forEach(function(arg) { | |
var offsetRegexp = /--offset=(\d+)/ | |
if (offsetRegexp.test(arg)) | |
positionOffset = parseInt(arg.replace(offsetRegexp, '$1')) | |
}) |
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
01. Die Krupps - Robosapien | |
02. KMFDM - Lust | |
03. Ministry - We Believe | |
04. Decoded Feedback - Breathe | |
05. Front 242 - Red Team | |
06. SA42 - Race of the Human Race | |
07. Portion Control - Swerve | |
08. Noise Unit - Firing Line | |
09. Autodafeh - Treasure Hunt | |
10. Orange Sector - Sturm (Martin Bodewell Remix) |
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
$("a.ajax").live('click',function(e) { | |
e.preventDefault(); | |
var $this = $(this); | |
url = $(this).attr('href'); | |
$.get(url,function(data) { | |
if(data) { | |
if( $this.hasClass('addHtmlToParent') ) { | |
$this.parent().append(data); // append return content to parent | |
} else { | |
eval(data); // execute return js |
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
<script type="text/javascript"> | |
function highlightDates(date) { | |
for ( var i = 0; i < agenda.length; i++) { | |
var start = agenda[i].substring(0,4) + '-' + num_pad(parseInt(agenda[i].substring(5,7)-1),2,'0') + '-' + agenda[i].substr(8,2); | |
//var start = agenda[i].date; | |
var dateString = date.getFullYear() + '-' + num_pad(date.getMonth(),2,'0') + '-' + num_pad(date.getDate(),2,'0'); | |
if (start == dateString) { | |
return [ true, 'ui-state-active' ]; | |
} | |
} |
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 | |
$list = array('this','that','theother','andthis'); | |
$evenList = (count($list)%2==0) ? true : false; | |
$listOne = array(); | |
$listTwo = array(); | |
if( $evenList ) { | |
$half = count($list)/2; | |
$listOne = array_slice($list,0,$half); |
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
$(document).ready(function() { | |
// initial input addition | |
$(".forum_thumbnail_addThumbnail").live('click',function() { | |
var $this = $(this); | |
$.get('/forum/ajaxGetThumbnailInput',function(data,status) { | |
if( status == 'success' ) { | |
$(data).appendTo($this.parent().parent()); | |
$this.parent().hide(); | |
} | |
}); |
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 get_attribute(self,attribute_name): | |
try: | |
return self.data[attribute_name] | |
except (KeyError,TypeError): | |
print self.data.__class__ | |
exit() |
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
import pprint | |
import psycopg2 | |
import psycopg2.extras | |
from psycopg2.extras import DictConnection | |
class pgImport(object): | |
"""Imports data to pg instance""" | |
def __init__(self,dbname='template1',user='postgres',password='postgres',host='localhost'): | |
"""Constructor""" | |
self.db = psycopg2.connect('dbname=%s user=%s host=%s password=%s' % (dbname,user,host,password)) |
OlderNewer