Skip to content

Instantly share code, notes, and snippets.

@rafael
rafael / imprenta_initializer.rb
Created November 5, 2013 21:24
Imprenta rack cache exmaple
# Add rack-cache and dali to your gemfile.
# gem 'rack-cache'
# gem 'dali'
Imprenta.configure do |config|
client = Dalli::Client.new('localhost:11211',
:value_max_bytes => 10485760)
config.middlewares.use Rack::Cache,
@rafael
rafael / imprenta.rb
Created November 5, 2013 21:33
Example of a config initializer for imprenta.
Imprenta.configure do |config|
config.storage :s3
config.middlewares.use Bugsnag::Rack
config.aws_bucket = "bucket"
config.aws_access_key_id = "xxxxid"
config.aws_secret_access_key = "xxxkey"
end
@rafael
rafael / controller.rb
Created November 5, 2013 21:52
Controller helper imprenta example.
imprenta_cache_template(template: "path/to/template",
layout: 'application',
id: 'mytemplateid')
@rafael
rafael / routes.rb
Created November 5, 2013 21:53
Imprenta routes example
get 'mystatic-pages/:id', :to => Imprenta.server
# Description:
# Utility commands to enable/disable and show status of continuous deployment.
#
# Commands:
# hubot continuous deployment disable - Disables continuous deployment
# hubot continuous deployment enable - Enables continuous deployment
# hubot continuous deployment status- Displays the status of continuous deployment
util = require 'util'
querystring = require('querystring');
module.exports = (robot) ->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGKSpYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKcHCBMXGyImVSRudWxs1QkKCwwNDg8QERJcTlNDb21wb25lbnRzVU5TUkdCXE5T
Q29sb3JTcGFjZV8QEk5TQ3VzdG9tQ29sb3JTcGFjZVYkY2xhc3NPECgwLjAyNzQ1MTAw
NjcgMC4yMTE3NjQ3MjMxIDAuMjU4ODIzNDg0MiAxTxAoMC4wMzkzODA3NDc4MiAwLjE2
@rafael
rafael / maybe_example.rb
Last active August 29, 2015 14:01
Issue with Maybe
# Null Object Pattern:
# http://devblog.avdi.org/2011/05/30/null-objects-and-falsiness/
require 'delegate'
RUBY_VERSION # => "2.0.0"
class NullObject
def method_missing(*args, &block)
self
{
"kind": "cluster#pod",
"id": "redis-master",
"labels": {
"name": "redis-master"
},
"desiredState": {
"manifest": {
"version": "",
"volumes": null,
ee565277f836: Pushing [================================> ] 7.67 MB/11.93 MB 34s
2014/06/28 17:17:37 Failed to upload layer: Put https://registry-1.docker.io/v1/images/ee565277f836cef00fce06a5b9ffde760a2932f7b76f63226924d049187bc40c/layer: read tcp 107.22.52.107:443: i/o timeout
@rafael
rafael / ArcanistScalastyleLinter.php
Created December 11, 2014 19:11
Scala Phabricator Linter
<?php
// source: https://secure.phabricator.com/D10405
// author: josh-newman
final class ArcanistScalastyleLinter extends ArcanistExternalLinter {
private $jarPath = null;
private $configPath = null;
public function getInfoURI() {
return 'http://www.scalastyle.org/';