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 names = ["Andrés Mejía", "Federico Builes", "Jairo Vasquez", "Jorge Cardona"]; | |
google.load("jquery", "1.3.2"); | |
google.setOnLoadCallback(onLoad); | |
function randomReadableString(length){ | |
if (!length) length = 10; | |
var vowels = "aeiou"; | |
var consonants = "bcdfghjklmnpqrstvwxyz"; | |
var ans = ""; | |
for (var i=0; i<length; ++i){ |
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 Admin::BaseController < ApplicationController | |
layout "admin" | |
before_filter :require_admin | |
ActiveScaffold.set_defaults do |config| | |
config.ignore_columns.add [:created_at, :updated_at] | |
end | |
end |
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
/* Sample solution for NCPC'08: Code Theft | |
* Author: Nils Grimsmo | |
* | |
* Warning: For a simple solution, look somewhere else... | |
* | |
* Solution: - View lines as symbols (hash once). | |
* - Build suffix tree for new code snippet | |
* - Find the matching statistics for each fragment | |
* from the repository. | |
* |
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
using namespace std; | |
#include <algorithm> | |
#include <iostream> | |
#include <iterator> | |
#include <sstream> | |
#include <fstream> | |
#include <cassert> | |
#include <climits> | |
#include <cstdlib> | |
#include <cstring> |
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
# -*- coding: utf-8 -*- | |
# This script will download the meaning of all names found on http://www.misabueso.com/nombres/ | |
# Date: July 20, 2009, at 2:14AM | |
# Author: Andrés Mejía <[email protected]> | |
# The format of the output file is as follows. | |
# For each name fetched, there are two lines: | |
# Line 1: The name itself | |
# Line 2: A valid HTML chunk containing the meaning of the name and some other stuff |
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
# encoding: utf-8 | |
require 'test_helper' | |
class Users::OmniauthCallbacksControllerTest < ActionController::TestCase | |
context "Facebook callback" do | |
setup do | |
# This a Devise specific thing for functional tests. See https://github.com/plataformatec/devise/issues/closed#issue/608 | |
request.env["devise.mapping"] = Devise.mappings[:user] | |
end | |
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
/* =========================================================== | |
* JFreeChart : a free chart library for the Java(tm) platform | |
* =========================================================== | |
* | |
* (C) Copyright 2000-2004, by Object Refinery Limited and Contributors. | |
* | |
* Project Info: http://www.jfree.org/jfreechart/index.html | |
* | |
* This library is free software; you can redistribute it and/or modify it under the terms | |
* of the GNU Lesser General Public License as published by the Free Software Foundation; |
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
require 'socket' | |
# Threaded echo server | |
# It services multiple clients at a time. | |
# Note that it may accept connections too much. | |
Socket.tcp_server_loop(16807) {|sock, client_addrinfo| | |
Thread.new { | |
begin | |
IO.copy_stream(sock, sock) | |
ensure |
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
NUMBER = /[0-9]+/ | |
HOURS_DESCRIPTOR = /\s*(h|hour|hours)\s*/i | |
MINUTES_DESCRIPTOR = /\s*(m|min|minute|minutes)\s*/i | |
SEPARATOR = /(:|and|&)/i | |
INITIAL_TAG = /\[\s*t\s*:\s*/i | |
FINAL_TAG = /\s*\]/i | |
HOURS_AND_MINUTES_WITH_SEPARATOR = /#{INITIAL_TAG}(#{NUMBER})#{HOURS_DESCRIPTOR}?\s*#{SEPARATOR}\s*(#{NUMBER})#{MINUTES_DESCRIPTOR}?#{FINAL_TAG}/ | |
HOURS_AND_MINUTES_WITHOUT_SEPARATOR = /#{INITIAL_TAG}(#{NUMBER})#{HOURS_DESCRIPTOR}\s*(#{NUMBER})#{MINUTES_DESCRIPTOR}?#{FINAL_TAG}/ | |
ONLY_HOURS = /#{INITIAL_TAG}(#{NUMBER})#{HOURS_DESCRIPTOR}#{FINAL_TAG}/ | |
ONLY_MINUTES = /#{INITIAL_TAG}(#{NUMBER})#{MINUTES_DESCRIPTOR}#{FINAL_TAG}/ |
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
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
require 'mysql' | |
require 'active_record' | |
ActiveRecord::Base.establish_connection( | |
adapter: "mysql", encoding: "utf8", database: "scores", username: "root", password: "" | |
) |
OlderNewer