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
# Decorating an anonymous function using a block is fairly easy | |
log_function = lambda do |fn, *args| | |
puts "About to call" | |
fn.call(*args) | |
puts "Did the call" | |
end | |
arrow_function = -> (*args) { puts "Being called now with #{args}" } | |
arrow_function = log_function.curry.(arrow_function) |
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/python | |
class Game(object): | |
def __init__(self, dimensions, cell_set): | |
self.dimensions = dimensions | |
self.cell_set = cell_set | |
def adjacent(self, a, b): | |
return abs(a[0] - b[0]) < 2 and abs(a[1] - b[1]) < 2 |
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 sys | |
import xapian | |
import string | |
from config_file import * | |
def indexThread(thread_id, content): | |
try: | |
# Open the database for update, creating a new database if necessary. | |
database = xapian.WritableDatabase(db_global, xapian.DB_CREATE_OR_OPEN) | |
indexer = xapian.TermGenerator() |
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 sys | |
import xapian | |
import string | |
from config_file import * | |
def indexThread(thread_id, content): | |
try: | |
# Open the database for update, creating a new database if necessary. | |
database = xapian.WritableDatabase(db_global, xapian.DB_CREATE_OR_OPEN) | |
indexer = xapian.TermGenerator() |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
<title>Testing Pie Chart</title> | |
<script type="text/javascript" src="js/d3.v3.min.js"></script> |
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 python | |
import requests | |
import json | |
import csv | |
import datetime | |
import os | |
from PIL import Image | |
from StringIO import StringIO | |
import fcntl | |
import sys |
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 csv | |
text_file = open('tweet_output.txt','w') | |
cr = csv.reader(open("tweets.csv","rb")) | |
for row in cr: | |
text_file.write(row[5]+" "+row[7]+"\n") | |
text_file.close() |
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
''' | |
This is a python translation of RecDep.java (gist: 2883635) with minor improvements (nested dictionaries replacing nested Lists) | |
''' | |
import nltk | |
import nltk.data | |
import pprint | |
import string | |
def preprocess(word): |
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 java.net.*; | |
import org.htmlparser.beans.LinkBean; | |
import org.htmlparser.http.HttpHeader; | |
import java.util.*; | |
import java.io.*; | |
public class LinkCheck | |
{ |
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
/*********************************************** | |
* RecDep - Information Retrieval System * | |
* @author - Dara McHugh * | |
* dara.mchugh22@student.computing.dcu.ie * | |
* * | |
* @version - 1.6 * | |
* @since - 2012 - 05 - 8 * | |
Screencast Available at: * | |
http://student.computing.dcu.ie/~mchugd22/java_ir.ogv | |
* * |