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
function objectKeys<T>(obj: T): (keyof T)[] { | |
return Object.keys(obj) as (keyof T)[]; | |
} | |
// ... | |
// Avoid the array of strings coming from Object.keys in TS source https://twitter.com/mattpocockuk/status/1502264005251018754?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1502264005251018754%7Ctwgr%5E1d1ec82885093024cd07b1d7a4a1d21f4e095a76%7Ctwcon%5Es1_c10&ref_url=https%3A%2F%2Fwww.mattstobbs.com%2Fobject-keys-typescript%2F | |
// objectKeys(myObj).find( ... ); |
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
mixin Address on Person { | |
late final String address; | |
say() { | |
print("Name: $name, Address: $address"); | |
} | |
} | |
class Person { | |
late final String name; |
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
#!/bin/bash | |
function print-help() { | |
echo "Clone database, use locally only." | |
echo "" | |
echo " mysql_clone username password old_db new_db" | |
echo "" | |
echo "Options:" | |
echo "" | |
echo " username: Database username from where you want to copy database" |
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
function loadUtils(opts) { | |
opts = opts || {}; | |
var $ = opts.$; | |
var Promise = opts.Promise; | |
var dbaClient = opts.dbaClient; | |
var tryAgainUri = opts.tryAgainUri; | |
var additionalQuestionsUri = opts.additionalQuestionsUri; | |
setupFormEvents(); |
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
function getUrlVars(url) { | |
var vars = [], hash; | |
var hashes = url.slice(window.location.href.indexOf('?') + 1).split('&'); | |
for(var i = 0; i < hashes.length; i++) | |
{ | |
hash = hashes[i].split('='); | |
vars.push(hash[0]); | |
vars[hash[0]] = hash[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
function loadUtils(opts) { | |
opts = opts || {}; | |
var $ = opts.$; | |
var Promise = opts.Promise; | |
var dbaClient = opts.dbaClient; | |
var tryAgainUri = opts.tryAgainUri; | |
function redirectToSign(leadId) { |
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
function loadUtils(opts) { | |
opts = opts || {}; | |
var $ = opts.$; | |
var Promise = opts.Promise; | |
var dbaClient = opts.dbaClient; | |
var tryAgainUri = opts.tryAgainUri; | |
function redirectToSign(leadId) { |
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
var DBA_CLIO_URI = 'https://6d821675.ngrok.io/'; | |
var LEAD_GROUP = 51940; | |
function getUrlVars(url) { | |
var vars = [], hash; | |
var hashes = url.slice(window.location.href.indexOf('?') + 1).split('&'); | |
for(var i = 0; i < hashes.length; i++) | |
{ | |
hash = hashes[i].split('='); | |
vars.push(hash[0]); |
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
const flatten = (array) => { | |
// Concat nested arrays recursively | |
const f = (arr, acc) => { | |
if(arr.length > 0) { | |
const first = arr[0]; | |
if(Array.isArray(first)) { | |
// Item is an array, start new call | |
acc = acc.concat(f(first, [])); | |
} else { |
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
var expect = require('chai').expect, | |
parse = require('../parser'); | |
describe('Replace Values', function() { | |
it('should replace values in string with object properties values', function() { | |
var obj = { | |
'ab49fd20': { | |
key_1: 'some data' | |
}, | |
'9822df87': { |
NewerOlder