I hereby claim:
- I am scooby on github.
- I am ben509 (https://keybase.io/ben509) on keybase.
- I have a public key ASCim-9mpu3uZAkD5_v29qJM1uFw6oDPEHp6vOXZdbpN4go
To claim this, I am signing this object:
// Use this with https://onflapp.wordpress.com/lincastor/ | |
// Lets you create double-clickable relative links in MacOS that sync over google drive and such. | |
// A "link" is just a text file with a relative path. | |
var app = Application.currentApplication(); | |
app.includeStandardAdditions = true; | |
function readUrl(url) { | |
var urlObj = $.NSURL.alloc.initWithString(url); | |
return $.NSString.alloc.initWithContentsOfURL(urlObj).UTF8String.trim(); |
try: | |
val = my_dict[key] | |
except KeyError: | |
handle_missing_value(key) | |
else: | |
normal_logic(key, val) |
I hereby claim:
To claim this, I am signing this object:
import java.util.ArrayDeque; | |
import java.util.Deque; | |
import java.util.Iterator; | |
import java.util.function.BinaryOperator; | |
import static java.util.Arrays.asList; | |
public class ByConcat { | |
/** | |
* Given a collection of objects, collapse by evenly weighted binary reduction. |
#!/usr/bin/env python | |
# vim: shiftwidth=4 expandtab ft=python | |
# Written by Ben Samuel, 2010. Released into public domain. | |
# Use at your own risk. | |
import os, sys, stat | |
import os.path as path | |
def statOrNone(ent): | |
try: |
(***************************************************** | |
Make a Genius mix into playlist | |
by Ben Samuel | |
This script is released into the public domain. | |
Purpose: to generate a playlist from a Genius mix for use with an | |
older iPod or to burn to CD. A genius mix, incidentally, is *not* | |
the same as a Genius playlist. | |
Requires: iTunes 9. Older versions don't have Genius Mixes, and |
use Data::Dumper; | |
use strict; | |
sub randlists { | |
sort { @$a <=> @$b } map([sort { $a <=> $b } map(int(rand() * 20), 0.. (15 + int(30 * rand())))], 0..2); | |
} | |
my(@bb) = randlists(); | |
#$bb[1] = [-2]; | |
my @b = map([@$_], @bb); | |
$Data::Dumper::Terse = 1; | |
$Data::Dumper::Indent = 0; |
#include <iostream> | |
using namespace std; | |
class x { | |
public: | |
virtual const char* symbol(void) { return "x"; } | |
virtual void speak() { cout << "'x' says 'your mom'" << endl; } | |
private: | |
static char* sym; | |
}; |
#include <iostream> | |
using namespace std; | |
int main(void) { | |
if(false < true) | |
cout << "False is less than true." << endl; | |
if(false > true) | |
cout << "False is greater than true." << endl; | |
if(true < false) |
#include <iostream> | |
#include <map> | |
using namespace std; | |
int main(void) { | |
multimap<int, int> mm; | |
for(int i = 20; i; i--) | |
mm.insert(make_pair((i * 3) & 7 + i, (i * 5) & 7)); | |
multimap<int, int>::iterator it = mm.begin(); |