Skip to content

Instantly share code, notes, and snippets.

View xander-miller's full-sized avatar

Xander Miller xander-miller

View GitHub Profile
@xander-miller
xander-miller / readme.md
Last active August 29, 2019 18:34
talent.test Credentials
@xander-miller
xander-miller / docker_sheet.md
Last active July 4, 2019 14:24
Docker Cheat Sheet

To restart a docker from the cli docker-machine restart

Removes images and containers. (best to stop all containers first) docker system prune -a

Removes all inactive volumes docker volume prune

Restart Docker after System prune to clean things out completely.

Build before your up. docker-compose build docker-compose up

Personality!

Tidbits

Diversity between groups is lower than diversity between individuals. If Diversity is our strength then we should be focusing on individuals not groups.

Outline

Introduction

@xander-miller
xander-miller / README.md
Last active May 19, 2016 01:50
Ntile dashing widget. A Dashing numbers widget that puts your numbers in statistical context.

#Ntile Widget# A Dashing widget that shows numbers in statistical context. This widget is also available in a GitHub Repository.

Demo Dashboard Screenshot

##Description## A Dashing widget (and an associated job) that will take any set of timestamped data, divid that data by day (or any other unit of time) and compare those units of time, and displays the current day in statistical context of previous days. It currently has three modes of operation Quartile, Quintile and Percentile (hench 'N'tile). The code is designed to take in a variety of data sources. Examples include:

  • Display number of new users your app has attracted this week compared to previous weeks.
  • Display how many customer service tickets have been closed by an individual employee today in the cont
@xander-miller
xander-miller / attributes_hash.rb
Created February 25, 2016 18:39
Code to get a Hash of attribute names and associated database types
Post.attribute_names.map {|n| [n.to_sym,Post.type_for_attribute(n).type]}.to_h
@xander-miller
xander-miller / reverse_array.rb
Created February 20, 2016 13:50
Reverse Array performance testing by Brian Bugh
def reverse arr
arr.reverse
end
def xander1 arr
out = []
neg_i = -1
arr.each do
out << arr[neg_i]
neg_i -= 1
@xander-miller
xander-miller / fish_cypher.rb
Last active December 27, 2015 19:49
Shopify asked me to send them a message so I created the best cover letter ever!!!
quote = 'The last ever dolphin message was misinterpreted as a surprisingly sophisticated attempt to do a double-backwards-somersault through a hoop whilst whistling the ‘Star Spangled Banner’, but in fact the message was this: So long and thanks for all the fish.'
alphabet = ('a'..'z').to_a
offset = 5
result_quote = ''
quote.each_char do |char|
if alphabet.include?(char)
char = alphabet.rotate(alphabet.index(char))[offset]
elsif alphabet.include?(char.downcase)
char = alphabet.rotate(alphabet.index(char.downcase))[offset].upcase
@xander-miller
xander-miller / directions.erb
Created October 2, 2013 19:19
Make the following changes to devise/registrations/new.html.erb:
<!-- add -->
<div class="control-group">
<%= f.label :name, class: 'control-label' %>
<div class="controls">
<%= f.text_field :name, :autofocus => true %>
</div>
</div>
<!-- end add -->
<div class="control-group">
@xander-miller
xander-miller / reversi.rb
Last active December 3, 2015 21:32
Rewriting the string reverse method.
def reversi str = ""
out = ''
1.upto str.length do |i|
out << str.chars[-i]
end
out
end
@xander-miller
xander-miller / user_decorator.rb
Last active November 24, 2015 19:23
Happy to use an &&= operator
class UserDecorator < Draper::Decorator
include Draper::LazyHelpers
delegate_all
class << self
def tagtionary
@tagionary ||= tagtionary!.clone
end
def tagtionary!