Skip to content

Instantly share code, notes, and snippets.

#include<iostream>
#include<fstream>
#include<iomanip>
using namespace std;
void headerfn();
string getstringinput(string);
void scoresfn(int, int, int, int, int, int);
int errorfn(int);
@pope
pope / scanner.php
Created January 26, 2011 03:23
A simple scanner that uses regular expressions to parse strings
<?php
class Scanner
{
private $_scans;
private $_idx;
public function __construct(array $scans)
{
$this->_scans = array();
function processListOfVideos(obj) {
// My assumption is that $('#listOfVideos') resolves to an unordered list so that I can put things into it
var ul = $('#listOfVideos');
$.each(obj.entry, function() {
var mediaUrl = this['media$group']['media$player'][0].url;
$('<li/>', { html: mediaUrl }).appendTo(ul);
});
// If there are any more videos, load them too
@pope
pope / gist:631324
Created October 17, 2010 21:40
Bash Prompt
PS1='\[\e[s\e[$((COLUMNS-20))C\e[0m\e[0;90m\]\d \t\[\e[u\]\n\[\e[0m\e[1m\]┌[\[\e[0;34m\]\u@\h\[\e[0m\e[1m\]][\[\e[0;34m\]\w`__git_ps1 " \[\e[0;35m\]%s"`\[\e[0m\e[1m\]]\n└╼ \[\e[0m\]'
PS2="└┈ "
PHP Notice: Undefined index: invalid in .../bah.php on line 4
PHP Stack trace:
PHP 1. {main}() .../bah.php:0
XTerm*faceName: Inconsolata
XTerm*faceSize: 11
BEGIN {loop {callcc {|cc| begin sleep; ensure cc.call end}}}
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
(function($) {
var max_height = 0;
$("div.col").each(function(){
var height = $(this).height();
if (height > max_height)
max_height = height;
}).height(max_height);
})(jQuery);
@pope
pope / url_dsl.rb
Created December 28, 2009 11:12 — forked from defunkt/url_dsl.rb
require 'open-uri'
# url dsl -- the ultimate url dsl!
#
# You just can't beat this:
#
# $ irb -r url_dsl
# >> include URLDSL
# => Object
# >> http://github.com/defunkt.json