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
// Insertion Sort | |
// Insertion sort is a comparison-based algorithm that builds a final sorted array one element at a time. | |
// It iterates through an input array and removes one element per iteration, finds the place the element belongs in the array, and then places it there. | |
// https://brilliant.org/wiki/sorting-algorithms/ | |
var array = [47,59,98,98,91,10,0,9,14,12] | |
console.log(insertionSort(array)) |
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
// Task: | |
// Find an item in an sorted array. | |
var array = [1,3,4,6,7,8,8,9,10,56,102,200,230] | |
var item = 200 | |
var globalCounter = 0 | |
console.log(binarySearch(array, 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
public exportFile(filename: string, type: string, data: any) { | |
const blob = new Blob([data], {type: type}); | |
this.exportBlob(blob, filename); | |
} | |
public exportBlob(blob: Blob, filename: string) { | |
if (window.navigator.msSaveOrOpenBlob) { | |
window.navigator.msSaveBlob(blob, filename); | |
} else { | |
const elem = window.document.createElement('a'); |
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, forwardRef, Input} from '@angular/core'; | |
import { NG_VALUE_ACCESSOR } from '@angular/forms'; | |
import { Principal } from '../../models/entities'; | |
import { Exportable } from './../Exportable'; | |
@Component({ | |
selector: 'edit-principal', | |
templateUrl: './edit.html', | |
styleUrls: ['../component.css'], | |
providers: [{provide: NG_VALUE_ACCESSOR, |
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
private List<Dictionary<string, object>> CSVToListOfDictionary(string csv) | |
{ | |
var items = new List<Dictionary<string, object>>(); | |
var headers = new List<object>(); | |
var lines = csv.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None); | |
for (var i = 0; i < lines.Length; i++) | |
{ | |
var line = lines[i].Trim(); |
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
<?php | |
$holidays = [ | |
// Start of Holidays | |
// Year by year | |
"2012-07-03", "2012-07-07", "2012-07-14", "2012-07-16", "2012-07-17", | |
"2012-07-21", "2012-07-24", "2012-07-28", |
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
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function () { | |
try { | |
//Assuming the location and filename as below | |
var url = "http://localhost:8080/homestead.txt"; | |
$.ajax(url) |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16B2555" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
<device id="retina4_7" orientation="portrait"> | |
<adaptation id="fullscreen"/> | |
</device> | |
<dependencies> | |
<deployment identifier="iOS"/> | |
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/> | |
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/> | |
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
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
/* APPENDIX 1-B: CLEANUP | |
This makes this sql query re-run able */ | |
DROP TABLE IF EXISTS JSON_TABLE; | |
DROP TABLE IF EXISTS SPLIT_TABLE; | |
DROP VIEW IF EXISTS SPLIT_VIEW; | |
/* APPENDIX 1-B: Prepare TABLE | |
Let's say this is an example table */ |
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
using Prognose.Domain; | |
using System; | |
using System.Collections.Generic; | |
using System.Data.Entity; | |
using System.Linq; | |
using System.Linq.Expressions; | |
namespace App.Domain | |
{ | |
public interface IEntity |