This file contains hidden or 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
import { Component } from '@angular/core'; | |
@Component({ | |
selector: 'app-root', | |
template: ` | |
<div class="ui container"> | |
<hr> | |
<div class="ui input"> | |
<input type="text" (input.debounce.1000)="search($event)"> | |
</div> |
This file contains hidden or 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
export function autoUnsubscribe(subscriptions: string[] = []) { | |
return (componentType) => { | |
const orgFactory = componentType.ngComponentDef.factory; | |
componentType.ngComponentDef.factory = (...args) => { | |
const component = orgFactory(...args); | |
componentType.ngComponentDef.onDestroy = () => { | |
if (component.ngOnDestroy) { | |
component.ngOnDestroy(); |
This file has been truncated, but you can view the full file.
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head><meta charset="utf-8" /> | |
<title>Assignment 2</title><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> | |
<style type="text/css"> | |
/*! | |
* | |
* Twitter Bootstrap |
This file contains hidden or 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 base64ToUint8Array(base64String) { | |
let raw = atob(base64String); | |
let uint8Array = new Uint8Array(raw.length); | |
for (let i = 0; i < raw.length; i++) { | |
uint8Array[i] = raw.charCodeAt(i); | |
} | |
let pdfSrc = unit8Array; | |
return pdfSrc; | |
} |
This file contains hidden or 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
import { data } from 'data'; | |
const fs = require('fs'); | |
const d = require('babylon') | |
export { config, data }; |
This file has been truncated, but you can view the full file.
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head><meta charset="utf-8" /> | |
<title>Instagram Filters</title><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> | |
<style type="text/css"> | |
/*! | |
* | |
* Twitter Bootstrap |
This file contains hidden or 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
/** | |
* Question 1 | |
*/ | |
//#region qs1 | |
function groupBy(arr, prop) { | |
return arr.reduce((group, item) => { | |
let value = item[prop]; | |
group[value] = group[value] || []; | |
group[value].push(item); |
This file contains hidden or 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
/** | |
* | |
* Levenshtein Distance Algorithm | |
* Source: https://en.wikipedia.org/wiki/Levenshtein_distance | |
* | |
*/ | |
function getThreshold(word) { | |
if (word.length < 5) return 3; | |
return 5; |