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
// Go through all the configured servers and organize them by category. | |
groups := make(map[string]map[string]interface{}, 0) | |
for _, s := range me.Configuration.Servers { | |
// Create the group entry if we don't already have one. | |
if _, ok := groups[s.Category]; !ok { | |
group := make(map[string]interface{}, 0) | |
servers := make([]map[string]string, 0) | |
group["servers"] = servers |
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
$job = array("frequency" => "weekly"); | |
$frequency = $job["frequency"]; | |
$interval = ( | |
$frequency === "weekly" | |
? "INTERVAL 7 DAY" | |
: ($frequency === "monthly" | |
? "INTERVAL 1 MONTH" | |
: "INTERVAL 1 DAY")); |
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 Arbiter extends Actor { | |
var occupants:List[String] = List() | |
def addOccupant(who: String) = { | |
occupants = occupants ::: List(who) | |
} | |
def removeOccupant(who: String) = { | |
val (b, a) = occupants span (x => x != who) | |
occupants = (b ::: a.drop(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
// Make sure the caller actually has the authority to call these methods. | |
handler.MapBefore([]string{"GET", "DELETE"}, "token", func(c context.Context) (error) { | |
// TODO: Figure out if this is the right way to preempt processing of a request. | |
// Check to see if this token is a supertoken. | |
if token, ok := c.Data()["Token"].(*ManagedToken); !ok { | |
goweb.API.RespondWithError(c, 500, "Internal authorization failure") | |
return fmt.Errorf("Failed to extract authorization token from request - this is bad/not right.") | |
} else { | |
if !token.Super { |
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
/* | |
* Copyright 2013-present Facebook, Inc. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
#include "phenom/defs.h" | |
#include "phenom/configuration.h" | |
#include "phenom/job.h" | |
#include "phenom/log.h" | |
#include "phenom/sysutil.h" | |
#include "phenom/printf.h" | |
#include "phenom/listener.h" | |
#include "phenom/socket.h" | |
#include "phenom/stream.h" | |
#include "phenom/string.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
package matcher | |
import "path" | |
import "regexp" | |
import "testing" | |
func BenchmarkPathMatcher(b *testing.B) { | |
for i := 0; i < b.N; i++ { | |
matches, err := path.Match("web-*-001", "web-us-001") | |
if err != nil { |
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
### Keybase proof | |
I hereby claim: | |
* I am tobz on github. | |
* I am tobz (https://keybase.io/tobz) on keybase. | |
* I have a public key whose fingerprint is D042 9CE5 F32A 6825 2F53 2452 C850 4302 CD64 0A65 | |
To claim this, I am signing this object: |
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
Perl> my $env = "indigo" | |
indigo | |
Perl> $env | |
indigo | |
Perl> my %env_mappings = ( "indigo" => { "bah" => "quux" } ) | |
2 | |
Perl> $env_mappings{"indigo"} |
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
extern crate openssl; | |
use openssl::ssl::{SslContext, SslMethod}; | |
fn main() { | |
let ssl_context = try!(SslContext::new(SslMethod::Sslv23)); | |
} |
OlderNewer