Skip to content

Instantly share code, notes, and snippets.

View marclundgren's full-sized avatar

Marc Lundgren marclundgren

View GitHub Profile
{
"meta": {
"theme": "actual"
},
"basics": {
"name": "Marc Lundgren",
"label": "Software Engineer",
"summary": "JavaScript nerd. TypeScript advocate. Serverless Cloud app builder. Dog lover.",
"picture": "https://avatars0.githubusercontent.com/u/1154834",
"phone": "(626) 404-8552",
oneLinerObjReturn = () => ({hello: 'world'})
oneLinerObjReturn()
const sum = ((a, b) => a + b)
const triangleNumber = (number) => {
const list = []
list.length = number
list.fill()
return list.map((_, index) => index + 1).reduce(sum, 0)
}
// Sunflower Slice
// Chrome
'a 🌻'.slice(0, 3); // "a �"
// Firefox
'a 🌻'.slice(0, 3); // "a \ud83c"
// Safari
'a 🌻'.slice(0, 3); // "a " 👈 running this results in a string that cannot be copied to the clipboard
/* https://functional.works-hub.com/learn/how-i-encrypted-a-database-without-storing-the-keys-anywhere-9da75?utm_source=reddit&utm_medium=organicsocial&utm_campaign=j.kaplan */
const crypto = require('crypto');
// Uses the PBKDF2 algorithm to stretch the string 's' to an arbitrary size,
// in a way that is completely deterministic yet impossible to guess without
// knowing the original string
function stretchString(s, salt, outputLength) {
return crypto.pbkdf2Sync(s, salt, 100000, outputLength, 'sha512');
}

Key Stretching

WEAK KEY

weak-key

It would take a computer about 3 MINUTES to crack your password

@marclundgren
marclundgren / controllers.application.js
Created January 4, 2018 18:23
you modified mdcClassNames twice
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
✍ Tattoo - yes
🏥Broken Bones - yes
🔫 Shot a gun - yes
😕 Quit a job - yes
✈️ Flown on a plane -yes
🚙💨 Driven 120mph - yes
🚁 Rode in a helicopter - yes
🍼 Watched someone give birth- no
😯 Watched someone die - yes
🏈 Been to an NFL game - no
/*
WIP - rewrite this javascript method to be a bit easier to maintain
https://jsfiddle.net/jossef/m3rrLzk0/
*/
const exportToCsv = (filename, rows) => {
const serializeRow = (serializedResult, cell, index) => {
let serializedCell = ''
@marclundgren
marclundgren / controllers.application.js
Created February 10, 2017 20:03
xs-option-not-found
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});