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
// Elements having "button" class will not fire the buddypress callbacks | |
$.each( $( ".item-list-tabs" ).data( "events" ).click, function ( i, obj ) { | |
var oldHandler = obj.handler; | |
obj.handler = function ( event ) { | |
if ( $( event.target ).hasClass( "button" ) ) | |
return true; | |
else | |
return oldHandler( event ); | |
} | |
} |
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
package stackoverflow; | |
import java.util.HashSet; | |
import java.util.Random; | |
import java.util.Set; | |
public class StringsContainingCharacters { | |
public static void main(String[] args) { | |
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
# Run it with rake db:populate | |
namespace :db do | |
desc "Empty the db and fill it with fake data" | |
task :populate => :environment do | |
require 'faker' | |
Rake::Task['db:reset'].invoke | |
def time_rand from = 0.0, to = Time.now | |
Time.at(from + rand * (to.to_f - from.to_f)) |
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
# Python 2.x | |
import random | |
import itertools | |
tasks = ['account', 'gestione classi', 'registro insegnanti', | |
'registro di classe', 'corsi di studio', 'gestione materie', 'bacheca', | |
'giornalino', 'pon', 'gestione circolari', 'gestione locali', | |
'inventario', 'viaggi', 'tasse'] | |
assignees = ["Marco", "Gabriele", "Raffaele"] |
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
# Requires python-imaging on Ubuntu | |
import PIL.Image, random, time | |
class AlexRand(random.Random): | |
'''This replicates how PHP does randint()''' | |
def randint(self, a, b): | |
self.seed() | |
return super(AlexRand, self).randint(a, b) | |
image = PIL.Image.new("1",(512,512)) # Creates a 512x512 bitmap |
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
trait MyOption[A] { outer => | |
import MyOption._ | |
def fold[B](map: A => B, getOrElse: => B): B | |
} | |
object MyOption { | |
def none[A]: MyOption[A] = |
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
? | |
help | |
logout | |
reboot | |
adsl | |
atm | |
brctl | |
cat | |
ethctl | |
ddns |
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 commands, re | |
import pprint | |
class Engine: | |
def __init__(self): | |
self.data = dict() | |
def updateSourceEvent(self): | |
self.updateData() |
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
package stackoverflow; | |
import java.io.UnsupportedEncodingException; | |
import java.net.URLDecoder; | |
import java.net.URLEncoder; | |
import java.util.HashSet; | |
import java.util.Iterator; | |
import java.util.LinkedHashMap; | |
import java.util.Map; | |
import java.util.Map.Entry; |
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
package stackoverflow; | |
import java.awt.Color; | |
import java.awt.image.BufferedImage; | |
import java.sql.Blob; | |
import java.sql.Connection; | |
import java.sql.PreparedStatement; | |
import java.sql.ResultSet; | |
import java.util.Arrays; |
OlderNewer