This file contains 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
So prefix this with `javascript:` and compress it to one line and it works a treat. I've been playing with it in the chrome inspetor to get started |
This file contains 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 Lasagna | |
EXPECTED_MINUTES_IN_OVEN = 40 | |
PREPERATION_MINUTES_PER_LAYER = 2 | |
def remaining_minutes_in_oven(actual_minutes_in_oven) | |
expected_minutes_in_oven - actual_minutes_in_oven | |
end | |
def preperation_time_in_minutes(number_of_layers) | |
number_of_layers * PREPERATION_MINUTES_PER_LAYER |
This file contains 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
# A simple function to return a signed, expiring url for Amazon Cloudfront. | |
# As it's relatively difficult to figure out exactly what is required, I've posted my working code here. | |
# This will require openssl, digest/sha1, base64 and maybe other libraries. | |
# In my rails app, all of these are already loaded so I'm not sure of the exact dependencies. | |
module CloudFront | |
def get_signed_expiring_url(path, expires_in, private_key_filename, key_pair_id) | |
# AWS works on UTC, so make sure you are not using local time |
This file contains 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
These are the median wait times for exercises that were mentorees during the 4 weeks preceeding 6th July 2019. | |
ballerina: hello-world-service: 7 days | |
ballerina: greeting-service: 9 days | |
ballerina: service-invocation: None mentored | |
ballerina: legacy-service-client: None mentored | |
ballerina: calculator-service: None mentored | |
ballerina: order-management: None mentored | |
ballerina: service-composition: None mentored |
This file contains 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
Control-flow (conditionals) | |
Control-flow (loops) | |
Equality | |
Exception handling | |
Inheritance | |
Pattern matching | |
Polymorphism | |
Recursion | |
Variables |
This file contains 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 'propono' | |
Propono.config do |config| | |
config.access_key = "AKIAIPE2MSOM5ZFGQBCQ" | |
config.secret_key = "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" | |
config.queue_region = "eu-west-1" | |
end | |
require 'twitter' | |
@twitter = Twitter::REST::Client.new do |config| | |
config.consumer_key = "OG9Zkag09onRe7b5ZLecO7HGb" |
This file contains 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
https://open.spotify.com/user/ihid/playlist/21VGlswVvue1Twda6NTafN |
This file contains 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
// Problem: This doesn't work | |
// true || throw new Error('some_var not defined') | |
// > Uncaught SyntaxError: Unexpected token throw | |
// I would approach this by creating another function, either for | |
// after the ||, or to wrap the whole thing. It's not exactly ideal | |
// but it feels idiomatic in a functional language. | |
//-- | |
// Suggestion 1: Define a wrapper function for throw |
This file contains 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
cloudfront_url = "https://123123.cloudfront.com" | |
images_dir = "/users/12321/" | |
manifest_file_path = "/users/12321/manifest.json" | |
images = Dir["#{@processing_directory}/html/**/*.jpg"].map do |filename| | |
"#{cloudfront_url}/#{images_dir}/#{filename}" | |
end | |
delivery_data = {images: images} |
This file contains 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 Pruner | |
def initialize(root) | |
@skip = [ | |
'.', '..', # System files | |
'.DS_Store', # Mac files | |
'determiners' # Directories that are programatic | |
] | |
@root = root | |
end |
NewerOlder