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
<?php | |
function endsWith($haystack,$needle) { | |
return (strcasecmp(substr($haystack, strlen($haystack) - strlen($needle)),$needle)===0); | |
} | |
$uri = $_SERVER['REQUEST_URI']; | |
if(is_404() && endsWith($uri, '/')) { | |
header("HTTP/1.1 301 Moved Permanently" ); | |
header("Location: ".substr($uri, 0, strlen($uri) - 1).".html"); | |
} |
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
#include <stdio.h> | |
#include <string.h> | |
#include <stddef.h> | |
#include <stdlib.h> | |
#include "mpi.h" | |
main(int argc, char **argv ) | |
{ | |
char buffer[100]; | |
int i, rank, size, type=99; | |
MPI_Status status; |
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
/** | |
* Copyright 2010 Coderloop.com. | |
* Author: Diego, the architect | |
**/ | |
package com.coderloop.puzzles; | |
import java.util.List; | |
import java.util.LinkedList; | |
//! This class implements a Megafasttree |
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
ActionMailer::Base.smtp_settings = { | |
:address => ENV['SMTP_ADDRESS'], | |
:port => ENV['SMTP_PORT'], | |
:domain => ENV['SMTP_DOMAIN'], | |
:user_name => ENV['SMTP_USERNAME'], #[email protected] for google apps accounts | |
:password => ENV['SMTP_PASSWORD'], | |
:authentication => "plain", | |
:enable_starttls_auto => true | |
} |
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
#!/bin/bash | |
java -jar your-project.jar |
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
(ns topfive.topfive | |
(:import | |
(java.io BufferedReader FileReader) | |
(java.util Hashtable))) | |
(def filename | |
(if (nil? *command-line-args*) | |
(str "topfive/topfive-a.in") | |
(first *command-line-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
@b = nil | |
@x = nil | |
@y = nil | |
@z = nil | |
def producer | |
Fiber.new do | |
loop do | |
@b = rand() | |
Fiber.yield #or consumer resume |
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
public class Blah { | |
int limit = 500; | |
int count = 0; | |
int B, X, Y, Z; | |
int c_state = 0, p_state = 0; | |
public void resume(String function) { | |
if(function == "producer") { |
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
over_paid = 53 | |
change = [] | |
[100, 25, 10, 5, 1].each do |i| | |
while i <= over_paid do | |
if i <= over_paid | |
over_paid -= i | |
change << i | |
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
class Page | |
Pages = { | |
'/about/' => { | |
:title => 'About', | |
:template => '/pages/about/index.html.erb' | |
} | |
} | |
def self.find_by_path(path) |
OlderNewer