Skip to content

Instantly share code, notes, and snippets.

View plainprogrammer's full-sized avatar

James Thompson plainprogrammer

View GitHub Profile
@plainprogrammer
plainprogrammer / Directions.md
Last active August 29, 2015 14:07
MongoDB Forced Reconfiguration

Directions

  1. On the primary, edit /etc/mongod.conf so that it will start and join the evgrs replica set.

  2. On the primary, restart mongod

  3. Get into a mongo console, and run the following series of commands:

    // First we need to connect to the mongo console and copy the current configuration. cfg = rs.conf()

@plainprogrammer
plainprogrammer / PlainBot.rb
Last active August 29, 2015 14:09
plainprogrammer's RRobot tank-bot
class PlainBot
include Robot
def tick(events)
get_up_to_speed
turn(2) if (time % turn_adjust == 0)
if events['robot_scanned'].empty?
turn_gun(1)
else
closest = events['robot_scanned'].sort.pop.pop
@plainprogrammer
plainprogrammer / example.rb
Created November 22, 2014 22:59
Renewable Objects (Immutability by Default) — A more Functional way to do OOP
class Person
include Renewable
attr_accessor :name, :age
def celebrate_birthday
self.renew(age: age + 1)
end
end
john = Person.new(name: 'John', age: 24)

Keybase proof

I hereby claim:

  • I am plainprogrammer on github.
  • I am plainprogrammer (https://keybase.io/plainprogrammer) on keybase.
  • I have a public key whose fingerprint is BF75 7722 AE10 7AE8 4C85 9DE5 5A1F 973B AEB0 18AF

To claim this, I am signing this object:

@plainprogrammer
plainprogrammer / .bash_profile
Created September 30, 2015 20:24
Kevin's PS1
%{$PROMPT_SUCCESS_COLOR%}%~%{$reset_color%} %{$GIT_PROMPT_INFO%}$(git_prompt_info)%{$GIT_DIRTY_COLOR%}$(git_prompt_status) %{$reset_color%}%{$PROMPT_PROMPT%}ᐅ%{$reset_color%}
@plainprogrammer
plainprogrammer / scary_service.rb
Last active October 28, 2015 18:02
Scary Reorder Service
module Services
module Column
class Reorder
attr_reader :column_to_move, :column_before, :column_set
def initialize(column_to_move_id, column_before_id = nil)
@column_to_move = ::Column.find(column_to_move_id)
@column_before = ::Column.find(column_before_id) if column_before_id.present?
@column_set = @column_to_move.column_set
end
current_user = User.where(full_name: "Jane Fonda").first
current_user.connections.where("full_name LIKE ?", "%bus%").select(:id, :full_name)
#
# User Load (0.6ms)
# SELECT `users`.`id`, `users`.`full_name` FROM `users`
# INNER JOIN `contacts` ON `users`.`id` = `contacts`.`connection_id`
# WHERE `contacts`.`user_id` = 980204181
# AND (full_name LIKE '%bus%')
#
# => #<ActiveRecord::AssociationRelation [
#!/usr/bin/ruby
rev_10_file = File.open('rev_10.rev', 'a')
rev_172_file = File.new('rev_172.txt', 'w+')
rev_192_file = File.new("rev_192.txt", "w+")
Dir['/Users/andybaxter/bind/*.com'].each do |filename|
File.open(filename, 'r+').readlines.each do |line|
domain = line.split.first
ip = line.split.last

Vineyard charter school under state scrutiny

Braley Dodson Daily Herald 17 hrs ago

The State Charter School Board, part of the Utah State Board of Education, did not take any action on closing a charter school Friday evening after concerns of student safety were brought forward.

The state charter board met to consider taking action on Franklin Discovery Academy in Vineyard, which opened Aug. 22 and teaches about 500 students in kindergarten through sixth grade. However, the board was ultimately unable to act on the matter because it did not issue a notice for the meeting 24 hours in advance.

The board has scheduled a meeting for 7 p.m. Saturday where possible action could be taken, which could include giving the school a warning, putting it on probation, allowing another entity to take over the school or voting to terminate the school.

Keybase proof

I hereby claim:

  • I am plainprogrammer on github.
  • I am plainprogrammer (https://keybase.io/plainprogrammer) on keybase.
  • I have a public key ASBc2-7Zt54OhRy1XbbESbRzPIL36TuAmOryyeOo58WWiwo

To claim this, I am signing this object: