Skip to content

Instantly share code, notes, and snippets.

View m0wfo's full-sized avatar

Chris Mowforth m0wfo

  • Planet Earth
View GitHub Profile
curl -L http://127.0.0.1:4001/v2/keys/foo -XPUT -d value="some value"
curl -L http://127.0.0.1:4001/v2/keys/foo
// Request
OPTIONS /v1/logs/logid HTTP/1.1
Host: js.logentries.com
Connection: keep-alive
Access-Control-Request-Method: POST
Origin: https://logentries.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36
Access-Control-Request-Headers: x-requested-with, content-type
Accept: */*
List<Iterator<Event>> iterators = FluentIterable.from(source_keys)
.transform(source_key -> getIterator(tail_query, source_key))
.filter(Predicates.notNull())
.toList()
@JsonTypeInfo(use=JsonTypeInfo.Id.CLASS)
public static class Wrapper {
}
@Test
public void testPolymorphicTypeIsReturnedWithoutMap() throws Exception {
Wrapper alertNotifyTag = new Wrapper();
String serialized = mapper.writeValueAsString(alertNotifyTag);
///
/// Parse + Logentries integration- based on this gist: https://gist.github.com/rogernolan/95ea615164e343b3bc54
/// proof-of-concept; might have the odd typo
///
var DEBUG = false;
var logger = (function(){
// Rely on Parse.com using node module caching to not duplicate this stuff.
class Array
def include?(value)
self.each do |range|
return true if range.include?(value)
end
return false
end
end
class Account
def initialize(balance)
@balance = balance
end
def transfer_money(to,amount)
p "Sender now has #{balance - amount}"
p "Recipient now has #{to.balance + amount}"
end
curl -O http://www.smudge-it.co.uk/pub/apache/incubator/couchdb/0.8.1-incubating/apache-couchdb-0.8.1-incubating.tar.gz
tar -xzvf apache-couchdb-0.8.1-incubating.tar.gz; cd !$
sudo port install automake autoconf libtool help2man spidermonkey taglib icu
./configure
make
sudo couchdb
class Integer
def round_to_nearest(*args)
most = self % args[0]
most > (args[0]/2)? self - most + args[0] : self - most
end
end
anumber = 349
p anumber.round_to_nearest(50)