I hereby claim:
- I am pch on github.
- I am pchm (https://keybase.io/pchm) on keybase.
- I have a public key ASDohLNPHrR-IY6_I7lzw1SiENKSNNIKkmT9-BQIpRQoxQo
To claim this, I am signing this object:
class User | |
has_attached_file :photo, | |
:processors => [:watermark], | |
:styles => { | |
:medium => { | |
:geometry => "300x300>", | |
:watermark_path => "#{Rails.root}/public/images/watermark.png" | |
}, | |
:thumb => "100x100>", | |
} |
find . -not \( -name .git -prune -o -name images -prune -o -name GeoLiteCity.dat -prune \) -type f -print0 | xargs -0 perl -pi -e 's/ +$//' |
I hereby claim:
To claim this, I am signing this object:
If you can put up with ads, you can easily trick Spotify and sign up for an account, even if you're not in one of the supported countries. You'll need:
First, set up an SSH tunnel, as described here: http://paulstamatiou.com/how-to-surf-securely-with-ssh-tunnel
You can install Unison on the Mac via homebrew (brew install unison
),
but it's very likely that it won't work properly, resulting in errors like:
Unison failed: Uncaught exception Failure("input_value: bad bigarray kind")
Fatal error: Lost connection with the server
If you need to pass data safely between Rails and Node, you can use the built-in Rails encryption.
The script below wraps ActiveSupport::MessageEncryptor
, allowing to create expiring JSON tokens that can be decoded in Node using a shared secret.
secret = "866b914a169d3969849966febafe8057bec6b82ea477e64682a11a2e61096797"
payload = { user_id: 1, name: "John Doe", role: "admin" }
EncryptedToken.encode(payload: payload, expires_at: 10.minutes.from_now, secret: secret)
#!/bin/sh | |
git_branch() { | |
echo $(git symbolic-ref HEAD 2>/dev/null | awk -F/ {'print $NF'}) | |
} | |
git_dirty() { | |
st=$(git status 2>/dev/null | tail -n 1) | |
if [[ $st == "" ]] | |
then |
#!/usr/bin/env ruby | |
# | |
# Recreate Lightroom catalog by replacing corrupt files with recovered copies | |
# | |
# Keeps the directory structure and creates the new catalog in a new path, | |
# which means you'll need at least 3x the size of your photos of free space. | |
# | |
# Dependencies: | |
# - ruby | |
# - exiftool |
#!/bin/bash | |
# | |
# Example pre-commit hook: triggers rubocop & eslint on staged files. | |
# | |
# To use it, create a symlink in your .git/hooks directory: | |
# | |
# $ ln -s $(pwd)/bin/pre-commit .git/hooks | |
set -e | |
# Ruby |
function initComponent(root, goDeep = true) { | |
const component = root.dataset.component; | |
const targets = {}; | |
const state = {}; | |
root.querySelectorAll(`[data-${component}-target]`).forEach((attr) => { | |
targets[attr.getAttribute(`data-${component}-target`)] = attr; | |
}); | |
Array.from(root.attributes).forEach((attr) => { |