Skip to content

Instantly share code, notes, and snippets.

View dashcraft's full-sized avatar
🏠
Remote Only

Daniel Ashcraft dashcraft

🏠
Remote Only
View GitHub Profile
interface IStrategy {
id: string,
test: (item: string) => boolean,
transform: (item: string) => Promise<any> | string
}
const strategies: IStrategy[] = [
{
id: 'some-name',
test: (item: string) => true | false,
@dashcraft
dashcraft / reduce
Created November 22, 2017 15:52
Reduce example
const arr = ['a','aab','bbc','aass']
let newArr = arr.reduce(function (str, item) {
if (item.includes('a')) {
console.log(item)
str = str + item;
}
return str;
}, '');
@dashcraft
dashcraft / LinkedInComponent.ts
Created July 12, 2017 20:10
A component for linkedin Oauth rest api
import { Component } from '@angular/core';
@Component({
selector: 'LinkedInExample',
template: '<a [href]="url">LinkedIn</a>'
})
export class LinkedInExample{
client_id: String = 'InputYourStupidClientStringHere';
redirect_uri:String = encodeURI("http://localhost:5000/whateverthehell");
@dashcraft
dashcraft / freecodecampObjPropLookup.js
Created June 11, 2017 18:52
sample solution for obj prop lookup
function lookUpProfile(firstName, prop){
// Only change code below this line
var match = contacts.filter(function(x){
return x.firstName == firstName;
});
console.log('match',match[0]);
if(match[0]){
if(match[0].hasOwnProperty(prop)){
@dashcraft
dashcraft / example.js
Created January 30, 2017 00:19
Free code camp part 4, rounding out javascript
const readline = require('readline');
const mike = readline.createInterface({
input: process.stdin,
output: process.stdout
});
// var person = function(personName,personAge){
// let name = personName;
// let age = personAge;