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
class Queue { | |
constructor() { | |
this.items = {}; | |
this.headIndex = 0; | |
this.tailIndex = 0; | |
} | |
enqueue(item) { | |
this.items[this.tailIndex] = item; | |
this.tailIndex++; |
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
.error { | |
color: red; | |
} |
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
<form [formGroup]="form"> | |
<div *ngFor="let prop of personProps"> | |
<label>{{ prop.label }}:</label> | |
<div [ngSwitch]="prop.type"> | |
<input *ngSwitchCase="'text'" [type]="prop.type" [formControlName]="prop.key"> | |
<input *ngSwitchCase="'number'" [type]="prop.type" [formControlName]="prop.key"> | |
<div *ngSwitchCase="'radio'"> | |
<label *ngFor="let option of prop.options"> | |
<input type="radio" |
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
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | |
import { ReactiveFormsModule, FormsModule} from "@angular/forms"; | |
import { FirstReactiveFormComponent } from './first-reactive-form.component'; | |
describe('FirstReactiveFormComponent', () => { | |
let component: FirstReactiveFormComponent; | |
let fixture: ComponentFixture<FirstReactiveFormComponent>; |
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
import { Component, Input, OnInit } from '@angular/core'; | |
import { FormGroup, FormControl, Validators } from '@angular/forms'; | |
@Component({ | |
selector: 'app-first-reactive-form', | |
templateUrl: './first-reactive-form.component.html', | |
styleUrls: ['./first-reactive-form.component.css'] | |
}) | |
export class FirstReactiveFormComponent implements OnInit { | |
form: FormGroup; |
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 | |
# File: ~/launch.sh | |
# Original Code Reference: http://dan.doezema.com/2013/04/programmatically-create-title-tabs-within-the-mac-os-x-terminal-app/ | |
# New-BSD License by Original Author Daniel Doezema http://dan.doezema.com/licenses/new-bsd/ | |
# Modified by Luke Schoen in 2017 to include loading new tabs for Rails Server and automatically open webpage in browser. | |
# References: https://developer.apple.com/library/content/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html |
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
import os | |
from PIL import Image, ImageOps, ImageDraw | |
def draw_ellipse(image, bounds, width=1, outline='grey', antialias=4): | |
# Use a single channel image (mode='L') as mask. | |
# The size of the mask can be increased relative to the imput image | |
# to get smoother looking results. | |
mask = Image.new( | |
size=[int(dim * antialias) for dim in image.size], | |
mode='L', color='black') |
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
import os | |
import sys | |
walk_dir = 'directory_parent' | |
# If your current working directory may change during script execution, it's recommended to | |
# immediately convert program arguments to an absolute path. Then the variable root below will | |
# be an absolute path as well. Example: | |
# walk_dir = os.path.abspath(walk_dir) | |
print('walk_dir (absolute) = ' + os.path.abspath(walk_dir)) |
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
# http://jamesbvaughan.com/python-twilio-scraping/ | |
#!/usr/bin/env python | |
from bs4 import BeautifulSoup | |
from twilio.rest import TwilioRestClient | |
import json | |
import os | |
import re | |
import requests |
NewerOlder