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
// JQUERY AJAX FUNCTIONALITY | |
// Added by Jason Larsen | |
// 06 May 2010 | |
// adds .ajax and .ajax_node classes | |
// .ajax will load any page via ajax | |
// .ajax_node will load the drupal node at the specified href (loads only content) | |
// | |
// to implement, simply give the desired element the class of either ajax, or ajax_node, | |
// and include a href tag with the desired URL |
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
#!/usr/bin/env ruby -wKU | |
letters_only = /^[a-z]+$/i | |
phone_number = /^\(\d{3}\)\s?\d{3}-\d{4}$/ | |
numbers_below_18 = /^(([0-1]?[0-8])|(-\d*))$/ | |
html_tag = /^<([A-Z]*)>(.*)<\/\1>$/ | |
print "Input text: " | |
input = gets.strip | |
until input == "quit" do | |
puts case input |
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 | |
if(isset($_REQUEST['name'])) { | |
// echo "Setting cookie..."; | |
if(!setcookie($_REQUEST['name'],$_REQUEST['value'],time() + $_REQUEST['exp'])) { | |
echo "ERROR: cookie not set!"; | |
} | |
} | |
?> | |
<html> | |
<head> |
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
#!/usr/bin/env ruby -wKU | |
require 'highline/import' | |
letters_only = /^[a-z]+$/i | |
phone_number = /^\(\d{3}\)\s?\d{3}-\d{4}$/ | |
numbers_below_18 = /^(([0-1]?[0-8])|(-\d*))$/ | |
html_tag = /^<([A-Z]*)>(.*)<\/\1>$/ | |
input = ask "Input text: " | |
until input == "quit" do | |
puts case input |
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
// Author: Jason Larsen | |
// Project: A program that downloads a webpage using an HTTP GET request. I probably | |
// will never use this because I'll just use curl -I anyway... but it was fun | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/socket.h> | |
#include <netinet/in.h> | |
#include <arpa/inet.h> |
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
void HTML::parse_links() { | |
string::const_iterator start, end; | |
start = src.begin(); | |
end = src.end(); | |
boost::match_results<std::string::const_iterator> what; | |
// handles single,double, and no quotes, and space/newlines, etc | |
boost::regex hrefs("href(\\s*)=(\\s)*[\"']?(.*?)[\"']?(\\s)*>",boost::regex_constants::icase); | |
while(boost::regex_search(start, end, what, hrefs)) { | |
cout << "link: " << string(what[3].first, what[3].second) << endl; |
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
# this is my simple, humble .bashrc file | |
alias ls='ls --color=auto' | |
alias ll='ls -l' | |
alias la='ls -A' | |
alias l='ls -CF' | |
alias crawler='cd ~/code/webcrawler;clear' | |
alias e='gedit' |
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
# from IRC hacks - http://oreilly.com/pub/ht/113 | |
import sys | |
import socket | |
import string | |
HOST="irc.freenode.net" | |
PORT=6667 | |
NICK="MauBot" | |
IDENT="maubot" | |
REALNAME="MauritsBot" |
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
#!/usr/local/bin/ruby | |
# crawler.rb | |
# by: Jason Larsen | |
# a generic web crawler that allows the user to do whatever they want by passing blocks | |
# @version 0.7 | |
# 14 Dec 2009 | |
# 0.6 things seem to be working well | |
# 0.7 modified so that URL's being added to the queue truncate fragments, | |
# this should save a lot of work |
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
print "x = " | |
x = gets.chomp.to_i | |
print "y = " | |
y = gets.chomp.to_i | |
# repeat until y = 0 | |
until y == 0 | |
# Assign x <- x mod y | |
puts "x = #{x} % #{y} = #{x%y} " | |
x = x % y |