Skip to content

Instantly share code, notes, and snippets.

View benphelps's full-sized avatar
🇺🇦
Slava Ukrayini!

Ben Phelps benphelps

🇺🇦
Slava Ukrayini!
View GitHub Profile
def sub_heading(content = nil)
@sub_headings ||= []
if content
@sub_headings.push content
elsif block_given?
@sub_headings.each do |sub_heading|
yield sub_heading
end
else
Enumerator.new do |y|
@benphelps
benphelps / .gitlab-ci.yml
Created January 11, 2017 16:33
A test / deploy setup I use
image: benphelps/docker-ruby-phantomjs:latest
Testing:
services:
- postgres:latest
variables:
POSTGRES_DB: test
POSTGRES_HOST: postgres
POSTGRES_USER: testuser
POSTGRES_PASS: testuser
environment: test
@benphelps
benphelps / .env
Last active January 17, 2017 14:51
Cloud66 Basic Postgres
POSTGRES_USER=phelps
POSTGRES_PASS=phelps
POSTGRES_HOST=localhost
module LocationHelper
def render_location_html(location)
content_tag :address do
content = ''
content += location.address_1 + tag(:br) if location.address_1.present?
content += location.address_2 + tag(:br) if location.address_2.present?
content += location.address_3 + tag(:br) if location.address_3.present?
content += location.short if location.short.present?
content
end
function Pixel (x, y, r, g, b)
F = CreateFrame("Frame", WorldFrame)
F.pixel = F:CreateLine()
F.pixel:SetStartPoint('TOPLEFT')
F.pixel:SetEndPoint('BOTTOMRIGHT')
F.pixel:SetColorTexture(r, g, b, 1)
F:SetPoint("TOPLEFT", WorldFrame, "TOPLEFT", x, y)
F:SetPoint("BOTTOMRIGHT", WorldFrame, "TOPLEFT", x + 1, y + 1)
F:Show()
return F
function obj2html(data) {
var html = '';
var attrs = '';
var blocks = '';
if (typeof data == 'object') {
_.each(data, function(value, key) {
if (typeof value == 'object' && value !== null) {
blocks += '<div class="panel panel-default">';
blocks += '<div class="panel-heading">';
blocks += key;
mixin features(header, desc, features)
section.feature-1
h2= header
.container
.row
h4.col-sm-10.col-sm-offset-1.text-center= desc
each feature in features
.col-sm-3.text-center
i(class="fa fa-#{feature.icon} fa-#{feature.size}")
h4= feature.title
<div class="col-sm-3 text-center">
<i class="fa fa-beer fa-lg"></i>
<h4>A title</h4>
<p>Some content</p>
</div>
<div class="col-sm-3 text-center">
<i class="fa fa-beer fa-lg"></i>
<h4>A title</h4>
<p>Some content</p>
</div>
<div>
<h1>Title</h1>
<p>Some Text</p>
</div>
<div>
<h1>Title</h1>
<p>Some Text</p>
</div>
@benphelps
benphelps / install_key.bash
Created May 29, 2016 09:46
Installs SSH public key for phelps.io
#!/bin/bash
mkdir -pm 0700 ~/.ssh
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3u+l5KphD8laWzKwgcb2OlKrld22AI5YlAcrj1DEsKGODDmdLFut5OlBrbxiWM/h3VWzM7HZc/cLY9F1N7CaMgoo79PDqY6c9embtgJX2j5VV7JFaarhtYoN+SCD09HjoHHlSQmoQe5+PHD11FzJxB2B7S/lGlAPpm4ExuSWllygSahtFkjUhg9+lczBZ0VlnvceNW9pPi/NVuGtuzvG9LHAUC5lf4jO293PLFwVtySZv6ik2xr+68bWyOGm6DqFB/KxrbCA5oowBQqTJrf63gKrwGnhczVboPAJmT9cqAPNaIdnrFnqsa+9n6Q3/HUUhrqUhFuQADRHZ9886QfMF [email protected]" >> ~/.ssh/authorized_keys