Skip to content

Instantly share code, notes, and snippets.

function insert_point( $road, $point )
{
// add 7 hours to the time so we're in the right timezone.
// you'll need to change this to match your timezone.
$seven_hours = 7 * 60 * 60;
$point[0] = $point[0] + $seven_hours;
// Find the right place to put it
$index = find_right_place( $road, $point[0] );
array_splice( $road, $index, 0, array($point) );
testing something.
@Insti
Insti / good codewars kata.md
Last active September 2, 2015 17:51
Good codewars kata

There are a lot of kata on codewars that are terrible.

8 kyu is the easiest and 1kyu is the hardest.

Here is a list of some the good ones: (This is not a complete list, and eventually there will be more than one for each level.)

The good kata

@Insti
Insti / Guardfile
Last active November 13, 2016 15:36
Guardfile for running Exercism (Ruby) tests.
# Guardfile to run Exercism Ruby tests.
# gem install guard
# gem install guard-shell
# Run with 'guard' command from your base exercism directory.
interactor :off
guard :shell do
@Insti
Insti / Users who are mentors.rb
Created May 26, 2017 17:53
Users who are track mentors
> User.all.reject { |user| user.track_mentor.empty? }.map { |user| [user.username, user.track_mentor] }
=> [["diana", ["python"]],
["bob", ["ruby", "haskell"]],
["charlie", ["javascript", "erlang", "elixir"]],
["alice",
["clojure",
"coffeescript",
"elixir",
"go",
"haskell",
@Insti
Insti / the_builder_of_things.rb
Last active May 24, 2022 08:25
A Ruby solution to "The builder of things" codewars kata
# https://www.codewars.com/kata/the-builder-of-things/ruby
# https://www.codewars.com/kata/reviews/5571e09a385f59d95f000063/groups/59426d64e6049310a70006ce
# imported to handle any plural/singular conversions
require 'active_support/core_ext/string'
class Thing
def initialize(name)
@properties = {}
is_the.name.send(name)
@Insti
Insti / quine.rb
Created November 17, 2017 22:31
I wanted to tweet about how awesome @mametter's rubyconf 2017 talk was.
eval$Quine=%q($><<"eval$Quine=%q(#$Quine)\n\n#rubyconf - @mametter's talk blew
my mind! :boom:\n")
#rubyconf - @mametter's talk blew my mind! :boom:
@Insti
Insti / day03.rb
Created December 3, 2021 20:25
Advent of code 2021 - Day 3
# frozen_string_literal: true
require 'minitest/autorun'
require_relative 'input_data'
class InputData
@file = __FILE__
def parse
raw_data.lines.map { |line| line.scan(/\d/) }
end