Skip to content

Instantly share code, notes, and snippets.

View iterion's full-sized avatar

Adam Sunderland iterion

View GitHub Profile
@iterion
iterion / spec.diff
Last active December 9, 2022 14:30
Remote OpenAPI Diff
4a5,44
> "ContractDetails": {
> "title": "ContractDetails",
> "nullable": true,
> "description": "Contract information. As its properties may vary depending on the country,\n you must query the [Show form schema](https://gateway.remote.com/eor/v1/docs/openapi.html#tag/Countries/operation/get_show_form_country) endpoint\n passing the country code and `contract_details` as path parameters."
> },
> "EmergencyContactDetails": {
> "title": "EmergencyContactDetails",
> "nullable": true,
> "description": "Emergency contact information. Its properties may vary depending on the country."
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-t
bind-key C-t send-prefix
# Set up reload key for tmux
bind r source-file ~/.tmux.conf \; display "Reloaded!"
unbind t
# Start at 1 rather than 0
require 'httparty'
require 'nokogiri'
require 'pry'
curr = {}
stats = nil
begin
res = HTTParty.get("http://www.xe.com/iso4217.php")
html = Nokogiri::HTML.parse(res)
links = html.css("#currencyTable td a").map { |a| a["href"] }.reject { |link| link[0] == "#" }
@iterion
iterion / idea.md
Last active January 2, 2016 12:49
Twitter Text Adventure Game Story Generation

Basic Idea

framework(user_data) -> story

Framework

The framework is an outline of a story or story elements that are basically a function of user_data. The framework at its simplest is a madlib that is randomly filled in with user data.

User Data

User data would probably include:

  • Name
@iterion
iterion / fees_mixin.js.coffee
Last active December 27, 2015 12:19
forceUnload
Molecule.FeesMixin = Ember.Mixin.create
actions:
addFee: ->
trade = @get('content')
fee = @store.createRecord('fee', {
trade: trade,
name: "broker fee",
price: 5,
editing: true
})
@iterion
iterion / encoding_fix.rb
Last active December 17, 2015 09:19
char encoding fix
def try_invalid_char_fix file
temp = Tempfile.new('fix_file')
File.open(file, "r").each_line do |line|
original_encoding = line.encoding.name
new_line = line.encode('UTF-16', original_encoding, :invalid => :replace, :replace => '')
temp.write new_line.encode('UTF-8', 'UTF-16')
end
temp.close
begin
#make copy of the old file
@iterion
iterion / document_perf.rb
Created May 15, 2013 00:08
mongoid document performance
require 'benchmark'
require 'mongoid'
class FakeModel
attr_accessor :test1, :test2, :test3, :test4, :test5, :test6, :test7, :test8
def initialize
self.test1 = 1
self.test2 = 1
self.test3 = 1
self.test4 = 1
@iterion
iterion / tddium.coffee
Created March 26, 2013 15:15
hubot script to start tddium builds
# Description:
# What you do about Tddium. Utilities to start tddium sessions
# Also contains some utilities I used in debugging (primarily unstick and start)
# I think session listing and stopping of builds is broken
# Credit mostly due to reading Tddium's gems' source.
#
# Dependencies:
# "underscore": "1.4.4"
#
# Commands:
@iterion
iterion / audit.rb
Last active December 11, 2015 23:28 — forked from adamstrickland/audit.rb
class Audit
include Mongoid::Document
include Mongoid::Timestamps
include RailsAdminImport::Import
class << self
def create_with_type_message_meta(_type, _message, _user)
self.create_without_type_message_meta({
:type => _type,
:content => _message,
@iterion
iterion / add_minutes.rb
Created December 7, 2012 00:07
Programming example
class IncorrectTimeFormatError < StandardError; end
class FakeTime
##
# :call-seq:
# FakeTime.add_minutes(time, minutes_to_add) => String
#
# Returns a new string with minutes_to_add added to the time
#
# FakeTime.add_minutes("9:23 AM", 10) #=> "9:33 AM"