Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Daniel Huckstep darkhelmet

View GitHub Profile
@darkhelmet
darkhelmet / pre-commit
Created Mar 21, 2019
Never commit ruby syntax errors
View pre-commit
#!/usr/bin/env bash
set -e
files() {
git diff --name-only --cached --full-index
}
check() {
while read file; do
filename=$(basename "$file")
View application_restriction.rb
class ApplicationRestriction
include Virtus.model(strict: true)
def to_module(&block)
restriction = self
mod = Module.new do
define_singleton_method(:inspect) do
"#{restriction.class.name}(#{restriction.attributes})"
end
end
@darkhelmet
darkhelmet / minikube-bootstrap.sh
Last active May 23, 2018 — forked from minrk/minikube-bootstrap.sh
bootstrap single node kubernetes with minikube (no vm)
View minikube-bootstrap.sh
set -x
# apt -y update
# apt -y dist-upgrade
# apt -y install docker.io
which minikube || (curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube && mv minikube /usr/local/bin/)
which kubectl || (curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x kubectl && mv kubectl /usr/local/bin/)
which helm || (curl -Lo helm.tar.gz https://kubernetes-helm.storage.googleapis.com/helm-v2.6.1-linux-amd64.tar.gz && tar -xzf helm.tar.gz && mv linux-amd64/helm /usr/local/bin/)
View Random Goodies
4 Azor, the Lawbringer
4 Back to Nature
1 Cruel Tutor
1 Deranged Hermit
1 Devoted Druid
3 Dire Fleet Daredevil
4 Dire Fleet Poisoner
1 Hypnotic Specter
1 Reflecting Pool
1 Stormbreath Dragon
View app.coffee
# Assignment:
number = 42
opposite = true
# Conditions:
number = -42 if opposite
# Functions:
square = (x) -> x * x
View gist:1de2b726e87be1a7a671
http://stackoverflow.com/questions/68569/text-watermark-on-website-how-to-do-it
<style type="text/css">
#watermark {
color: #d0d0d0;
font-size: 200pt;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
position: absolute;
width: 100%;
View active_admin.rb
# if you want to monkey patch every controller, put this in initializers/active_admin.rb
ActiveAdmin::ResourceController.class_eval do
include ActiveAdmin::CSVStream
end
View gist:11390354
~/dev/go/src/github.com/darkhelmet/enumerable (master?) » go test -i
can't load package: package github.com/stretchr/testify/assert: cannot find package "github.com/stretchr/testify/assert" in any of:
/Users/darkhelmet/local/go/src/pkg/github.com/stretchr/testify/assert (from $GOROOT)
/Users/darkhelmet/dev/go/src/github.com/stretchr/testify/assert (from $GOPATH)
@darkhelmet
darkhelmet / gist:9987548
Last active Aug 29, 2015
Uploading a specific pair of files to rails 4.0.4/rbx 2.2.6/nginx 1.5.12/passenger enterprise 4.0.40 fails
View gist:9987548
App 11159 stderr: [ 2014-04-04 22:31:47.7216 11313/0x2320c(Worker 4) utils.rb:52 ]: *** Exception NoMethodError in Rack application object (undefined method `-' on nil:NilClass.) (process 11313, thread 0x2320c(Worker 4)):
App 11159 stderr: from kernel/delta/kernel.rb:78:in `- (method_missing)'
App 11159 stderr: from kernel/common/string.rb:1997:in `[]='
App 11159 stderr: from kernel/common/string.rb:1332:in `slice!'
App 11159 stderr: from /home/deploy/cogs/shared/bundle/rbx/2.1/gems/rack-1.5.2/lib/rack/multipart/parser.rb:113:in `get_current_head_and_filename_and_content_type_and_name_and_body'
App 11159 stderr: from /home/deploy/cogs/shared/bundle/rbx/2.1/gems/rack-1.5.2/lib/rack/multipart/parser.rb:19:in `parse'
App 11159 stderr: from kernel/common/kernel.rb:460:in `loop'
App 11159 stderr: from /home/deploy/cogs/shared/bundle/rbx/2.1/gems/rack-1.5.2/lib/rack/multipart/parser.rb:17:in `parse'
App 11159 stderr: from /home/deploy/cogs/shared/bundle/rbx/2.1/gems/rack-1.5.2/lib/rack/multipart.rb:25:in `p
@darkhelmet
darkhelmet / docker-ruby-fpm.sh
Created Mar 4, 2014 — forked from dysinger/docker-ruby-fpm.sh
Using docker to build deb of ruby so you don't need to use rvm or something on the server
View docker-ruby-fpm.sh
cat > Dockerfile <<\EOF
FROM ubuntu:12.04
RUN apt-get update
RUN apt-get install -y ruby1.9.3 build-essential \
libc6-dev libffi-dev libgdbm-dev libncurses5-dev \
libreadline-dev libssl-dev libyaml-dev zlib1g-dev
RUN gem install fpm --bindir=/usr/bin --no-rdoc --no-ri
RUN apt-get install -y curl
RUN curl ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p484.tar.gz|tar oxzC /tmp
WORKDIR /tmp/ruby-1.9.3-p484
You can’t perform that action at this time.