Skip to content

Instantly share code, notes, and snippets.

Avatar

Xander Miller xander-miller

View GitHub Profile
@xander-miller
xander-miller / readme.md
Last active Aug 29, 2019
talent.test Credentials
View readme.md
@xander-miller
xander-miller / docker_sheet.md
Last active Jul 4, 2019
Docker Cheat Sheet
View docker_sheet.md

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

View personality.md

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 / attributes_hash.rb
Created Feb 25, 2016
Code to get a Hash of attribute names and associated database types
View attributes_hash.rb
Post.attribute_names.map {|n| [n.to_sym,Post.type_for_attribute(n).type]}.to_h
@xander-miller
xander-miller / reverse_array.rb
Created Feb 20, 2016
Reverse Array performance testing by Brian Bugh
View reverse_array.rb
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 / reversi.rb
Last active Dec 3, 2015
Rewriting the string reverse method.
View reversi.rb
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 Nov 24, 2015
Happy to use an &&= operator
View user_decorator.rb
class UserDecorator < Draper::Decorator
include Draper::LazyHelpers
delegate_all
class << self
def tagtionary
@tagionary ||= tagtionary!.clone
end
def tagtionary!
View checkpoint15.md

Checkpoint 15

Questions

  • Which version of Ubuntu should I use?
  • What is bash?

Comments

Concerns

@xander-miller
xander-miller / lamba.rb
Created Jun 25, 2015
Used a lamda to DRY up my code. Ruby skill up! 👍
View lamba.rb
res.sort! do |x,y|
archived = -> (z) {[:archived, 'archived'].include?(z.status)}
if archived.call(x) && archived.call(y)
0
elsif !archived.call(x) && archived.call(y)
-1
elsif archived.call(x) && !archived.call(y)
1
elsif !archived.call(x) && !archived.call(y)
0
@xander-miller
xander-miller / affirmations.md
Created Apr 2, 2015
My compassion meditation affirmations
View affirmations.md
  • X is an aspect of the Universe just like me.
  • May X be well and happy.
  • May X have no fears or sorrows.
  • May X be healthy and free from illness.
  • May X live calmly and peacefully.
  • When see wrong done to X I will try to right it.
  • When I see X suffering I will try to heal it.
  • When I see X at war I will try to end it.
  • X is just as deserving of compassion as myself or anyone.