Skip to content

Instantly share code, notes, and snippets.

{
"default": {
"template": "{author.display_name|author.name}{message}",
"keys": {
"time_text": "{} | ",
"timestamp": {
"template": "{} | ",
"format": "%Y-%m-%d %H:%M:%S"
},
"author.badges": {
(function() {
var currentApp = Application.currentApplication()
currentApp.includeStandardAdditions = true
if (currentApp.systemInfo().systemVersion >= "10.15") {
var musicApp = Application("Music")
} else {
var musicApp = Application("iTunes")
}

Scrutinator

Scrutinator is a simple API server application for creating and logging credit checks. The Transunion API is consumed with a client gem.

Installation

Edit the .env.development file: uncomment and set the required enviornment variables.

bin/setup

gemfile_lock = Pathname('./Gemfile.lock')
root_lf = Bundler::LockfileParser.new(gemfile_lock.read)
Dir['./gems/*/'].each do |gem_dir|
Dir.chdir(gem_dir) do
next unless gemfile_lock.exist?
lf = Bundler::LockfileParser.new(gemfile_lock.read)
lf.specs.each do |spec|
matching_gem = root_lf.specs.find { |s| s.name == spec.name }

Configuring OSX for Parallel Tests

We use parallel_tests to speed up our test suite. It works by splitting the tests and running them in concurrent processes. This can cause some issues with resource limits in OSX.

The main culprit is MYSQL. By default each table is stored in it's own file. This is great when backing up, but can cause you to run into the OSX limit on open files.

The simplest approach I found to fixing this is configuring mysql to store all tables in one file. This can be set in your my.cnf file. If MYSQL was installed via homebrew, you should create this file `/usr/local/etc/my.cnf'. The key setting is: innodb_file_per_table = OFF. You can just copy my my.cnf fille here: https://gist.github.com/gmanley/e9c9d0e5f7c3f94eb9a9#file-my-cnf

The rest of the settings are just optimizations and aren't needed to fix this issue. I recommend using them though.

require 'pry'
require 'octokit'
REPO_PATH = 'CouponTrade/giftcards'
WHITE_LIST = %w[
drachma
]
def in_giftcards_dir
Dir.chdir(File.expand_path('~/projects/giftcards')) do
@gmanley
gmanley / net_http_auto_proxy_monkey.rb
Created October 30, 2014 21:36
A collection of monkey patches I use when debugging with Charles. They force various http clients to use the `http_proxy` env variable as a proxy. You shouldn't actually add these to your project.
class Net::HTTP
def proxy?
!!_env_proxy_uri
end
def proxy_address
_proxy_uri_from_env.host
end
def proxy_port
@gmanley
gmanley / README.md
Created July 17, 2014 07:54
Designing initial interface for MediaMerge.

Create a job. A job is what defines what we are merging.

job = MediaMerge::Job.new

Create an input. An input defines a media source.

sub_input = MediaMerge::Input.new('sample (en).mkv')

Input#tracks returns an array of Track objects.

@gmanley
gmanley / give_access.sh
Last active April 11, 2018 16:32
How to setup locked down sftp access
# This script should be modified and run whenever you need to add another sftp user.
echo "This script needs root access"
sudo -s
### Modify
user=soshistyle
# Directory you want to give access to
base_dir=/var/www/vhosts/style.soshified.com
# The group that should still be able to access $base_dir
properties = Mongo::MongoClient.new['flipt_v1_0']['properties']
properties.find.each do |property|
properties.update(
{ "_id" => property['_id'] },
{ "$set" => {
"geolocation" => {
"type" => "Point",
"coordinates" => [
property["location"]['longitude'].to_f,
property["location"]['latitude'].to_f