Skip to content

Instantly share code, notes, and snippets.

View daneb's full-sized avatar
🏠
Working from home

Dane Balia daneb

🏠
Working from home
View GitHub Profile
@daneb
daneb / gist:eca29ae30cfaadc56b5a
Last active August 29, 2015 14:23
Crystal "for"
for i in [1,2,3,4,5] do
puts "Hello"
end
Benchmark.bm(7) do |x|
x.report("for:") { for i in 1..x; a = "1"; end }
x.report("times:") { n.times do ; a = "1"; end }
x.report("upto:") { 1.upto(n) do ; a = "1"; end }
end
## Javatar Report
### System Informations
* Javatar Version: `1.0.0`
* Sublime Version: `3083`
* Package Path: `/Users/danebalia/Library/Application Support/Sublime Text 3/Packages`
* Javatar Channel: `stable`
* Sublime Channel: `stable`
* Is Debug Mode: `False`
* Platform: `osx`
* As Packages: `True`
@daneb
daneb / saas.txt
Created October 27, 2015 21:07
Assignment, Pair vs Solo Programming
I truly enjoyed the assignment as it immediately layed down the foundational rules for modern software development.
TDD before production! Red-Green-Refactor! Also enjoying the steady increase in pace and technical knowledge,
and how the assignment brought the knowledge (lectures) to bear. If it's not obvious, I like that the assignment was "practical"
and not theoretical alone.
Pair programming is done frequently in my time and I don't like it. It makes me uncomfortable. But I see it's value. We are using scrum
and given I have a low attention to detail and can possibly rabbit hole, having pair programming at points where I hit stumblingblocks
has proven rather helpful, allowing to move what is blocking the pathway.
Solo programming is what I do best, but over the past year I've come to realise how dangerous that is.
require 'lotus/model'
require 'lotus/mailer'
Dir["#{ __dir__ }/bookmarks/**/*.rb"].each { |file| require_relative file }
Lotus::Model.configure do
##
# Database adapter
#
# Available options:
#
@daneb
daneb / get_metric_controller.rb
Created December 30, 2015 12:07
Exposure Fail -
# Controller
module Web::Controllers::Home
class GetMetric
include Web::Action
expose :method_to_use, :query_string
handle_exception ArgumentError => :handle_no_query_string
def call(params)
raise ArgumentError.new('Failed to provide parameters') if params.env["QUERY_STRING"].empty?
@daneb
daneb / Error.log
Last active January 14, 2016 11:30
Lotus Migration Creation
➜ shopping_cart_service git:(db_session) ✗ bundle exec lotus generate migration create_authtrackers
/Users/X/Documents/Github/Hetzner/shopping-cart-service/prototype/shopping_cart_service/apps/authtracker/application.rb:3:in `<top (required)>': Authtracker is not a module (TypeError)
from /Users/X/Documents/Github/Hetzner/shopping-cart-service/prototype/shopping_cart_service/config/environment.rb:5:in `require_relative'
from /Users/X/Documents/Github/Hetzner/shopping-cart-service/prototype/shopping_cart_service/config/environment.rb:5:in `<top (required)>'
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/gems/lotusrb-0.6.0/lib/lotus/environment.rb:364:in `require'
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/gems/lotusrb-0.6.0/lib/lotus/environment.rb:364:in `require_application_environment'
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/gems/lotusrb-0.6.0/lib/lotus/commands/generate/migration.rb:30:in `initialize'
from /Users/X/.rvm/gems/ruby-2.3.0-preview2/gems/lotusrb-0.6.0/lib/lotus/cli_sub_commands/g
@daneb
daneb / Problem.txt
Last active February 17, 2016 09:43
Hanami JSON Oddity I don't understand
The repo for the code is at (pretty basic):
https://github.com/daneb/hanami_json_oddity
I understand the best approach is to use a controller here and not the view.
But I am trying to understand the behaviour of what I am seeing.
In my view, when I take my hash and .to_json it, the final result from the HTTP GET is:
{ status: "success", data: { get: { message: 'Created new session via registration', session_id: session_id } }}.to_json
{&quot;status&quot;:&quot;success&quot;,&quot;data&quot;:{&quot;get&quot;:{&quot;message&quot;:&quot;Created new session via registration&quot;,&quot;session_id&quot;:12}}}
@daneb
daneb / Server.cs
Created April 8, 2016 22:03
Simple Web Framework
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace RackPrototype
require './custom_errors'
require './validation'
require 'byebug'
module FlattenIntegerArray
def self.flatten(input_array)
FlattenIntegerArray::Validation.not_empty_and_is_an_array?(input_array)
return input_array if FlattenIntegerArray::Validation.flat_array?(input_array)
FlattenIntegerArray::Validation.valid_input?(input_array)
@daneb
daneb / config.ru
Last active July 17, 2016 13:20
Rack::Cors Configuration Middleware
require 'rack'
require './cors_wired'
app = Rack::Builder.new do
use CorsWired.new
run lambda { |env| [200, {'Content-Type' => 'text/plain'}, ['OK']] }
end
run app