Skip to content

Instantly share code, notes, and snippets.

View rjcorwin's full-sized avatar

R.J. (Steinert) Corwin rjcorwin

  • Khan Academy
  • Burlington, VT
View GitHub Profile
@rjcorwin
rjcorwin / comments.md
Created March 27, 2023 13:48 — forked from maddy531/comments.md
Mark pull request comments with a purpose

This is a set of ‘statuses’ that pull request comments must be marked with to help explain intent.

  • Praise: Highlighting positive practice/action
  • Nitpick: Trivial non-blocking preference-based requests
  • Suggested Change: Propose improvements to the current subject
  • Issue: Highlights specific problems with the subject under review
  • Todo: Are small, trivial, but necessary changes
  • Question: Questions are appropriate if you have a potential concern but are not quite sure if it's relevant or not
  • Required: This must be fixed before merge
  • Thought: Represent an idea that popped up from reviewing
  • Chore: Simple tasks that must be done before the subject can be “officially” accepted
T.case.setLocation = async function setLocation() {
// Get a Device to set the location
const device = await this.deviceService.getDevice()
if (device) {
let syncLocation = device.syncLocations[0]
let locationSetting = syncLocation.value.slice(-1).pop()
let location = {
[`${locationSetting.level}`]: locationSetting.value
}
return location
@rjcorwin
rjcorwin / nested-form.component.ts
Created June 16, 2017 14:50 — forked from dherges/nested-form.component.ts
Angular2: reactive, nested form
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
import { AbstractControl, FormArray, FormBuilder, FormControl,
FormGroup, Validators } from '@angular/forms'
@Component({
selector: 'nested-form',
template:
`
<form [formGroup]="myForm" (ngSubmit)="submit()">
<h4>Form</h4>
#copy your ssh key to root@raspberrypi
ssh [email protected] 'aptitude install screen iotop'
ssh [email protected] 'screen -d -m -S clone'
ssh [email protected] 'echo u > /proc/sysrq-trigger'
ssh [email protected] 'screen -x clone'
dd if=/dev/mmcblk0 bs=1M of=/dev/sda
#detach with "CRTL-a d"
iotop
@rjcorwin
rjcorwin / phonegap_download_example.html
Created July 10, 2013 14:36 — forked from nathanpc/phonegap_download_example.html
Warning, I don't think this works.
<!DOCTYPE html>
<html>
<head>
<title></title>
<!-- Android
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
<meta charset="utf-8">-->
<!-- iPad/iPhone specific css below, add after your main css >
@rjcorwin
rjcorwin / reduce.js
Created November 29, 2012 20:35 — forked from greatseth/reduce.js
couchdb reduce function to find min value
function (key, values, rereduce) {
var min = Infinity
for (var i = 0; i < values.length; i++) {
if (typeof values[i] == 'number') {
min = Math.min(values[i], min)
}
}
return min