Last updated: 2014-12-25
mdfind -attr kMDItemContentType "kMDItemContentType == '*'" -onlyin . | awk -F"kMDItemContentType =" '{print $2}' | sort | uniq -c | sort -r
# create the template | |
template = PageOfflineTemplate.new | |
template.quote = quote | |
template.pages = quote.build_pages | |
# Here I render a template with layout to a string then a PDF | |
pdf = PDFKit.new template.render_to_string(:template=>"quotes/review.html.haml") | |
module Tire | |
module Disable | |
module ClassMethods | |
def mock_es_response_doc | |
@mock_es_response_doc ||= | |
'{"took": 1,"timed_out": false,"_shards": {"total": 5,"successful": 5,"failed": 0},"hits": {"total": 0,"max_score": null,"hits": []}}' | |
end | |
def enable! &blk | |
old_enabled = @tire_enabled || false |
class CustomMarkdown < Middleman::Extension | |
$markdown_options = { | |
autolink: true, | |
fenced_code_blocks: true, | |
no_intra_emphasis: true, | |
strikethrough: true, | |
tables: true, | |
hard_wrap: true, | |
with_toc_data: true | |
} |
sub Y{$p=$_;for$i(1..4){$p=join'',map{substr+($k&&$k-$i?$p:join'',map{s/@//g;s | |
/(.)\1/++($a=$1)/eg;$_|'@'x4}$p=~/.{4}/g),3+$_%4*4-($_/4|0),1}0..15}$p}$_='@'x | |
16;for(`stty cbreak`;print"\e[2J\e[H";$_=Y map{$k=index+JDACB,getc}0..2){$k=0; | |
1until$r=0|rand 16,!/@/||s/(?<=^.{$r})@/rand>.1?A:B/e;printf'%4s|%s',/\w/&&1<< | |
(ord)-64,++$g%4?'':$/for/./g;last if$e=WIN x/K/||Y!~/@/&&LOSE}print$e # [2048] |
// Add / Update a key-value pair in the URL query parameters | |
function updateUrlParameter(uri, key, value) { | |
// remove the hash part before operating on the uri | |
var i = uri.indexOf('#'); | |
var hash = i === -1 ? '' : uri.substr(i); | |
uri = i === -1 ? uri : uri.substr(0, i); | |
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i"); | |
var separator = uri.indexOf('?') !== -1 ? "&" : "?"; | |
if (uri.match(re)) { |
require 'rubygems' | |
require 'rspec' | |
require 'webmock' | |
require 'vcr' | |
require 'pry' | |
# in a Rails app, this would be in an initializer | |
WebMock.disable_net_connect!( | |
allow_localhost: true, | |
net_http_connect_on_start: true |
Unless you are using Safari on OSX, most browsers will have some kind of free plugin that you can use to export the browser's history. So that's probably the easiest way. The harder way, which seems to be what Safari wants is a bit more hacky but it will also work for other browsers. Turns out that most of them, including Safari, have their history saved in some kind of sqlite database file somewhere in your home directory.
The OSX Finder cheats a little bit and doesn't show us all the files that actually exist on our drive. It tries to protect us from ourselves by hiding some system and application-specific files. You can work around this by either using the terminal (my preferred method) or by using the Cmd+Shft+G in Finder.
Once you locate the file containing the browser's history, copy it to make a backup just in case we screw up.
Picking the right architecture = Picking the right battles + Managing trade-offs
//@flow | |
import request from 'request' | |
import crypto from 'crypto' | |
import rp from 'request-promise' | |
export type AuthServiceConfig = { | |
authorizeEndpoint: string, | |
clientId: string, | |
audience: string, | |
scope: string, |