Skip to content

Instantly share code, notes, and snippets.

View skunkworker's full-sized avatar

John Bolliger skunkworker

View GitHub Profile
@mmmries
mmmries / CssHelper.js
Created March 16, 2016 16:35
Client Specific Colorschemes in Javascript
var ColorConversion = require('helpers/ColorConversion');
/**
Used for parsing all css rules on the document
object and replacing any default brand color
instances with the client's brand color scheme.
@class CssHelper
@example
```javascript
@tovbinm
tovbinm / crontab
Created February 22, 2012 01:10
Logrotate & upload nginx logfiles to s3://bucket/dt=..../hostname.log...gz
# Nginx - logrotate & upload to S3
0 0 * * * /usr/sbin/logrotate /etc/logrotate.d/nginx
15 0 * * * s3cmd put /var/log/nginx/access.log-`date +"\%Y\%m\%d"`.gz s3://$LOGS_BUCKET_NAME/nginx-access/`date +"dt=\%Y\%m\%d"`/`hostname -s`.access.log-`date +"\%Y\%m\%d"`.gz
@tzvetkoff
tzvetkoff / zwch.py
Last active January 2, 2018 08:20
Sublime Text plugin that tries to detect and mark zero-width characters
import sublime
import sublime_plugin
class ShowZeroWidthCharacters(sublime_plugin.EventListener):
"""
Tries to detect and mark zero-width joiners, non-joiners, and other invisible characters.
Most of the characters were detected by manually testing code points from C++ specs.
http://en.cppreference.com/w/cpp/language/identifiers
"""
@dteoh
dteoh / rails_5_engine_tests.md
Last active April 28, 2018 03:31
Adding extra test paths to Rails 5 `rails test` command

In Rails 4.x, you could add extra test paths to rake test by overriding the Rake task like so:

Rake::Task['test:run'].clear

namespace :test do
  Rails::TestTask.new(:run) do |t|
    paths = ['test/**/*_test.rb']
    paths << 'engines/foo_engine/test/**/*_test.rb'
@elberskirch
elberskirch / jekyll-deployment.md
Last active January 16, 2019 03:06
Capistrano deployment for jekyll

introduction

This is a short rundown for setting up deployment for a jekyll blog using a self-hosted git repository and a vserver running nginx. Deployment is done with capistrano (version 3).

Github is probably the most common and most convenient way to host your code for your jekyll blog, but sometimes you might want to keep everything under your own control or you're just curious what barebones git does for you.

setting up the git repository

For setting up a git repository on a linux machine I used this guide. A short wrapup:

  • add a git user
@pablopaul
pablopaul / deploy.rb
Last active February 5, 2019 19:19 — forked from cannikin/deploy.rb
Notify Sentry of a new release via Capistrano with Auth Token
# This task will notify Sentry via their API[1] that you have deployed
# a new release. It uses the release timestamp as the `version`
# (like 20151113182847) and the git ref as the optional `ref` value.
#
# This task requires several environment variables be set (or just
# hardcode the values in here if you like living on the edge):
#
# ENV['SENTRY_API_ENDPOINT'] : API endpoint, https://app.getsentry.com
# ENV['SENTRY_ORG'] : the organization for this app
# ENV['SENTRY_PROJECT'] : the project for this app
$ rails r 'File.write("./viz.html", Rails.application.routes.router.visualizer)'
$ ruby -r webrick -e "s = WEBrick::HTTPServer.new(:Port => 8080, :DocumentRoot => Dir.pwd); trap('INT') { s.shutdown }; s.start"
$ open "http://localhost:8080/viz.html"

Prerequisites:

You'll need:

  1. A paid ngrok account
  2. A reserved domain on ngrok, e.g. the FQDN you're generating certs for
  3. A registed domain and access to change DNS records

How to

  1. Install certbot and ngrok
  • brew cask install certbot ngrok
@ianmurrays
ianmurrays / deploy.rb
Created July 21, 2011 17:26
Runs test locally before deploying on capistrano.
set :test_log, "logs/capistrano.test.log"
namespace :deploy do
before 'deploy:update_code' do
puts "--> Running tests, please wait ..."
unless system "bundle exec rake > #{test_log} 2>&1" #' > /dev/null'
puts "--> Tests failed. Run `cat #{test_log}` to see what went wrong."
exit
else
puts "--> Tests passed"
@stuartsierra
stuartsierra / fresh-chrome.sh
Last active October 13, 2020 16:07
Launch new instances of Google Chrome on OS X with isolated cache, cookies, and user config
#!/usr/bin/env bash
# fresh-chrome
#
# Use this script on OS X to launch a new instance of Google Chrome
# with its own empty cache, cookies, and user configuration.
#
# The first time you run this script, it will launch a new Google
# Chrome instance with a permanent user-data directory, which you can
# customize below. Perform any initial setup you want to keep on every