Skip to content

Instantly share code, notes, and snippets.

@cybo42
cybo42 / Main.dart
Last active September 21, 2020 15:33
Dartstuff
void main() {
Animal bob = new Kitten();
bob.grow();
bob.grow();
bob.birthday();
print(bob.speak());
Animal x = new Puppy();
print(bob);
@cybo42
cybo42 / postmortem.md
Created September 27, 2016 01:58 — forked from mlafeldt/postmortem.md
Example Postmortem from SRE book, pp. 487-491

Shakespeare Sonnet++ Postmortem (incident #465)

Date

2015-10-21

Authors

  • jennifer
  • martym

Keybase proof

I hereby claim:

  • I am cybo42 on github.
  • I am cybo42 (https://keybase.io/cybo42) on keybase.
  • I have a public key whose fingerprint is B8C5 81D2 3BD9 5B09 3708 ECB2 5652 81D5 4E7A E4CB

To claim this, I am signing this object:

@cybo42
cybo42 / routecache.js
Last active August 29, 2015 14:07
Expressjs caching middleware, taken from http://slides.com/bradoyler/nodejs-content-sites presentation
module.exports.cacheSeconds = function(ttl) {
return function(req, res, next) {
var cache = cachestore.get(req.path);
if (cache) {
res.send(cache);
} else {
var send = res.send;
res.send = function(string) {
var body = string instanceof Buffer ? string.toString() : string;
@cybo42
cybo42 / fixed
Last active September 21, 2020 15:35
fix "[object Object] does not exist" issue in node-mongo when using non ObjectId keys
//
var _open = function(self, options, callback) {
var collection = self.collection();
// Create the query
var query = self.referenceBy == REFERENCE_BY_ID ? {_id:self.fileId} : {filename:self.filename};
query = null == self.fileId && self.filename == null ? null : query;
options.readPreference = self.readPreference;
// Fetch the chunks
if(query != null) {
@cybo42
cybo42 / graphite.conf
Created March 4, 2013 16:21
Forked from GregMefford/graphite.conf but was corrupted so recreated content
NameVirtualHost *:80
# You may need to manually edit this file to fit your needs.
# This configuration assumes the default installation prefix
# of /opt/graphite/, if you installed graphite somewhere else
# you will need to change all the occurances of /opt/graphite/
# in this file to your chosen install location.
<VirtualHost *:80>
# ServerName graphite
@cybo42
cybo42 / init.gradle
Created June 16, 2011 19:23
Gradle Growl Notifications
// File: ~/.gradle/init.gradle
class GrowlNotifyListener extends BuildAdapter {
void buildFinished(BuildResult result) {
if (result.failure) {
growlNotify "Gradle [${result?.gradle?.rootProject?.project?.name}]: failure", result.failure.message, true
} else {
growlNotify "Gradle [${result?.gradle?.rootProject?.project?.name}]: finished", 'Build successful'
}
}
@cybo42
cybo42 / CheckPluginVersions.groovy
Created July 25, 2009 21:50 — forked from robfletcher/CheckPluginVersions.groovy
Grails - List Plugins that can be upgraded
import groovy.xml.dom.DOMCategory
includeTargets << grailsScript("_GrailsInit")
includeTargets << grailsScript("_GrailsPlugins")
def getAvailablePluginVersions = {
def plugins = [:]
eachRepository {repo, url ->
use(DOMCategory) {
pluginsList.'plugin'.each {plugin ->