This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Windows PowerShell | |
Copyright (C) Microsoft Corporation. All rights reserved. | |
Try the new cross-platform PowerShell https://aka.ms/pscore6 | |
Loading personal and system profiles took 1057ms. | |
C:\Users\thata> vagrant global-status --debug | |
INFO global: Vagrant version: 2.2.5 | |
INFO global: Ruby version: 2.4.6 | |
INFO global: RubyGems version: 2.6.14.4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SomeObject | |
def initialize(object_to_extend) | |
@object_to_extend = object_to_extend | |
end | |
def respond_to?(sym, include_private = false) | |
super(sym, include_private) || object_to_extend_responds?(sym) | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
require 'open-uri' | |
module GTFS | |
class AgencyImporter < BaseImporter | |
def import(agency_ids = []) | |
options = { | |
document_build: ->(row){{agency_id: row[:agency_id], agency_timezone: row[:agency_timezone], agency_name: row[:agency_name]}} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"tree" => { | |
"id" => "26", | |
"name" => "My Awesome Tree", | |
"variable_ids" => ["ValueDriver-1"], | |
"variables" => [ | |
{ | |
"id" => "ValueDriver-1", | |
"name" => "My Value Driver", | |
"type" => "ValueDriver", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"value": { | |
"id": 1, | |
"value_driver_id": 1, | |
"position": 0, | |
"value_id": "ValueDriver-2", | |
"next_operand": "*", | |
"created_at": "2014-04-15T06: 44: 38.724Z", | |
"updated_at": "2014-04-15T06: 44: 38.724Z" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
set_size() | |
}); | |
$(window).resize(function(){ | |
set_size(); | |
}); | |
function set_size(){ | |
var h = $(window).height(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Numeric | |
#usage: | |
#9.53.as_percent(11,2) => 86.64 | |
#9.53.as_percent(11,1) => 86.6 | |
#9.53.as_percent(11) => 87 | |
def as_percent(max,precision = 0) | |
((self.to_f/max)*100).round(precision) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TimeSpan | |
attr_accessor :milliseconds | |
def self.from_milliseconds(milliseconds) | |
me = TimeSpan.new | |
me.milliseconds = milliseconds | |
return me | |
end | |
def self.from_seconds(seconds) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hash | |
def structify | |
return OpenStruct.new(self) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def articleize | |
me = self.downcase | |
an_startswith = ['a','e','i','o','u'] | |
an_exceptions = ['unit'] #add more when you think of them! | |
if me.start_with?(*(an_startswith + an_exceptions)) | |
return "an #{self}" | |
else | |
return "a #{self}" |