Can Code | Can't Code | |
---|---|---|
Loves Coding | Yes | N/A |
Hates Coding | Maybe | No |
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
# gem 'wrest' in Gemfile | |
# optionally, `Wrest.logger = Rails.logger` in `config/initializers/wrest.rb` | |
module OpenAI | |
def self.base_uri | |
'https://api.openai.com/v1'.to_uri( | |
default_headers: { | |
'Content-Type' => 'application/json', | |
'Authorization' => "Bearer #{ENV.fetch('OPENAI_KEY', nil)}" |
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' | |
csv_file = ARGV[0] | |
def section_heading(title) | |
"\n#{'-' * 10} #{title} #{'-' * 10}\n\n" | |
end | |
rows = CSV.read(csv_file)[1..-1].map do |r| | |
created_at = DateTime.parse(r[21]) |
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
type Operation struct { | |
timeValue time.Time | |
s2IDLevel int64 | |
s2ID int64 | |
// ... | |
// ... | |
} | |
func (op operation) Perform() error { | |
surgeRepository := repository.NewSurgeRepository() |
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
type Operation struct { | |
timeValue time.Time | |
s2IDLevel int64 | |
s2ID int64 | |
// ... | |
// ... | |
} | |
func (op operation) Perform(surgeRepository repository.SurgeRepository) error { | |
// ... |
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
type Operation struct { | |
timeValue time.Time | |
s2IDLevel int64 | |
s2ID int64 | |
// ... | |
// ... | |
} | |
func (op operation) Perform(surgeRepository repository.SurgeRepository) error { | |
// ... |
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 File.expand_path('../../../spec_helper', __FILE__) | |
require File.expand_path('../fixtures/classes', __FILE__) | |
require File.expand_path('../shared/clone', __FILE__) | |
describe "Array#clone" do | |
it_behaves_like :array_clone, :clone | |
it "copies frozen status from the original" do | |
a = [1, 2, 3, 4] | |
b = [1, 2, 3, 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
require File.expand_path('../../../spec_helper', __FILE__) | |
require File.expand_path('../shared/dup_clone', __FILE__) | |
describe "Object#clone" do | |
it_behaves_like :object_dup_clone, :clone | |
it "preserves frozen state from the original" do | |
o = ObjectSpecDupInitCopy.new | |
o2 = o.clone | |
o.freeze |
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
(function(undefined) { | |
if (typeof(this.Opal) !== 'undefined') { | |
console.warn('Opal already loaded. Loading twice can cause troubles, please fix your setup.'); | |
return this.Opal; | |
} | |
// The Opal object that is exposed globally | |
var Opal = this.Opal = {}; | |
// All bridged classes - keep track to donate methods from Object |
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
module Benchmarks | |
def self.fact_inline_js(n) | |
%x{ | |
if(n > 1) { | |
return n * this.$fact_inline_js(n-1); | |
} | |
else { | |
return 1; | |
} | |
} |
NewerOlder