# .ruby-version
2.5.1
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] OpenSSL::PKey::RSA has undocumented `e=' and `n=' methods | |
exponent = "10001" | |
modulus = "9201EBD5DC974FDE613A85AFF2728627FD2C227F18CF1C864FBBA3781908BB7BD72C818FC37D0B70EF8708705C623DF4A9427A051B3C8205631716AAAC3FCB76114D91036E0CAEFA454254D135A1A197C1706A55171D26A2CC3E9371B86A725458E82AB82C848AB03F4F0AF3127E7B2857C3B131D52B02F9A408F4635DA7121B5B4A53CEDE687D213F696D3116EB682A4CEFE6EDFC54D25B7C57D345F990BB5D8D0C92033639FAC27AD232D9D474896668572F494065BC7747FF4B809FE3084A5E947F72E59309EDEAA5F2D81027429BF4827FB62006F763AFB2153C4A959E579390679FFD7ADE1DFE627955628DC6F2669A321626D699A094FFF98243A7C105" | |
rsa = OpenSSL::PKey::RSA.new | |
e = exponent.to_i(16) | |
n = modulus.to_i(16) | |
rsa.e = OpenSSL::BN.new(e) | |
rsa.n = OpenSSL::BN.new(n) |
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
$: (Dollar Colon) is basically a shorthand version of $LOAD_PATH. | |
contains an array of paths that your script will search through when using require. | |
$0 (Dollar Zero) contains the name of the ruby program being run. This is typically the script name. | |
$* (Dollar Splat) is basically shorthand for ARGV. $* contains the command line arguments that were passed to the script. | |
$? (Dollar Question Mark) returns the exit status of the last child process to finish. | |
$$ (Dollar Dollar) returns the process number of the program currently being ran. | |
$~ (Dollar Tilde) contains the MatchData from the previous successful pattern match. | |
$1, $2, $3, $4 etc represent the content of the previous successful pattern match. | |
$& (Dollar Ampersand) contains the matched string from the previous successful pattern match. | |
$+ (Dollar Plus) contains the last match from the previous successful pattern match. |
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 Material { | |
public static readonly ACRYLIC = new Material(`ACRYLIC`, `AC`, `Acrylic`); | |
public static readonly ALUM = new Material(`ALUM`, `AL`, `Aluminum`); | |
public static readonly CORK = new Material(`CORK`, `CO`, `Cork`); | |
public static readonly FOAM = new Material(`FOAM`, `FO`, `Foam`); | |
// private to diallow creating other instances of this type. | |
private constructor(public readonly key: string, public readonly id: string, public readonly name: string) {} | |
public toString(): string { |
- https://javascript.info/import-export
- https://stackoverflow.com/questions/37200080/how-to-export-imported-object-in-es6
export let months = ['Jan', 'Feb', 'Mar','Apr', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
export const MODULES_BECAME_STANDARD_YEAR = 2015;
export function sayHi() { ... }
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
// Simplified from https://github.com/dabit3/dynamodb-documentclient-cheat-sheet | |
/** | |
* DynamoDB.DocumentClient | |
*/ | |
const dynamoDbClient = new AWS.DynamoDB.DocumentClient({ | |
region: 'ap-southeast-1', | |
convertEmptyValues: true, | |
httpOptions: { | |
connectTimeout: 1000, // 1s |
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
# Setup | |
# ./spec/spec_helper.rb | |
Capybara.register_driver :poltergeist do |app| | |
options = { | |
debug: true, # debug mode, verbose logs | |
timeout: 30, | |
window_size: [360, 640], | |
phantomjs_options: [ | |
'--proxy-type=none', |
NewerOlder