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

@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
require 'benchmark'
begin
require 'active_support/values/time_zone'
rescue LoadError
puts 'Please do `gem install active_support`'
exit(1)
end
def benchmark_hash(hash, key, inverted_hash)
Benchmark.bmbm do |x|
@gmanley
gmanley / gist:4657954
Last active December 20, 2016 17:10
Random avatar in plug.dj every 5 seconds.
(function randomAvatar() {
var userPoints = parseInt($('#user-points-value').text().replace(',', ''));
var avatars = [];
$.each(AvatarOverlay.avatarSets[0], function(i, value) {
if (value.required <= userPoints) {
avatars = avatars.concat(value.avatars);
};
});
require 'net/telnet'
headings = %w(id expires bytes cache_key)
rows = []
localhost = Net::Telnet::new("Host" => "localhost", "Port" => 11211, "Timeout" => 3)
matches = localhost.cmd("String" => "stats items", "Match" => /^END/).scan(/STAT items:(\d+):number (\d+)/)
slabs = matches.inject([]) { |items, item| items << Hash[*['id','items'].zip(item).flatten]; items }
@gmanley
gmanley / uuid.rb
Last active December 26, 2015 18:09
UUID helper module.
require 'securerandom'
module UUID
UUID_PATTERN = /(\w{8})-?(\w{4})-?(\w{4})-?(\w{4})-?(\w{12})/
VALID_UUID_PATTERN = /\A#{UUID_PATTERN}\Z/
def self.included(base)
base.send(:extend, ClassMethods)
end
#!/usr/bin/ruby
# -*- encoding: binary -*-
$stdout.sync = $stderr.sync = true
# this is used to show or watch the number of active and queued
# connections on any listener socket from the command line
require 'aggregate'
require 'csv'
require 'raindrops'
require 'optparse'
validates :full_url,
presence: true,
format: { with: URI.regexp(%w(http https)),
message: "The 'url' parameter is invalid!" }