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
// | |
// C - style | |
// | |
int sum( int boundary ) | |
{ | |
int i, sum = 0; | |
for( i = 1; i <= boundary; i++ ) | |
sum += 1; |
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
#pragma once | |
template<typename T> | |
class Singleton | |
{ | |
public: | |
template<typename... Args> | |
static | |
T* GetInstance( Args... args ) |
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
-module(echo). | |
-compile(export_all). | |
go() -> | |
register(echo, spawn(echo, loop, [])), | |
echo ! { self(), hello }, | |
receive | |
{ _Pid, Msg } -> | |
io:format("~w~n", [Msg]) | |
end, |
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
#pragma once | |
// | |
// Abstract interface | |
// | |
class IFile | |
{ | |
public: | |
virtual ~IFile() = 0; |
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
mnesia:transaction( | |
fun() -> | |
qlc:e( | |
qlc:q( [ { U#name, U#reputation } || | |
U <- mnesia:table(users), | |
U#user.age < 21]) | |
) | |
end | |
) |
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
class ExamplesController < ApplicationController | |
before_filter :authenticate_ip if Rails.env.production? | |
http_basic_authenticate_with :name => "login", :password => "pass" if Rails.env.production? | |
end |
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
require 'rack' | |
module Rack | |
class PrettyPrint | |
def initialize(app, options = {}) | |
@app, @options = app, options | |
end | |
def call(env) | |
status, headers, response = @app.call(env) |
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
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"os" | |
"runtime" | |
"sync" | |
"time" |
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 | |
# palindrome.rb | |
module Palindrome | |
ALPHABET = ('a'..'z').to_a + ('A'..'Z').to_a | |
def palindrome? | |
normalized == normalized.reverse | |
end |
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 script will boot app.js with the number of workers | |
// specified in WORKER_COUNT. | |
// | |
// The master will respond to SIGHUP, which will trigger | |
// restarting all the workers and reloading the app. | |
var cluster = require('cluster'); | |
var workerCount = process.env.WORKER_COUNT || 2; | |
// Defines what each worker needs to run |
OlderNewer