Skip to content

Instantly share code, notes, and snippets.

View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View machine.js
//----------------------------------------
const findingDevice = {
initial: 'findingDevice',
states: {
/* BASE STATES */
foundDevice: {
type: 'final',
},
View machine.js
const ComponentStateMachine = Machine({
id: 'component:record-screen',
initial: 'ssr',
states: {
ssr: {
on: {
MOUNT: {
target: 'loading',
},
},
View machine.js
/**
* For a given `state` from `CompositeMachine` should the video indicated by
* `state.context.videoSrc` be in a playback state or a paused state.
* @param state node from the `CompositeMachine`.
* @returns `false` (indicating a playing state) or `true` (indicating a paused
* state). `null` or `undefined` state nodes are `true`.
*/
function isVideoPaused(state) {
if (state === null || state === undefined) {
return true;
View schema_sample.gql
type Query {
article(id: ID!): Article
page(id: ID!): Page
product(id: ID!): Product
profile(id: ID!): Profile
}
type Article {
# Unique identifier for this piece of content */
id: ID!
View ViewSizeObserver.java
package com.android.workaround;
import android.app.Activity;
import android.graphics.Rect;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
/**
* When an {@link Activity} is launched with
@bryanjswift
bryanjswift / keybase.md
Created Aug 14, 2014
Keybase github verification
View keybase.md

Keybase proof

I hereby claim:

  • I am bryanjswift on github.
  • I am bryanjswift (https://keybase.io/bryanjswift) on keybase.
  • I have a public key whose fingerprint is A439 647C C223 4E86 D25D 9449 6FD4 B193 F9A5 6D56

To claim this, I am signing this object:

@bryanjswift
bryanjswift / abbreviated-unbound.conf
Last active Mar 24, 2019
Unbound (http://unbound.net/) configuration for local network device testing.
View abbreviated-unbound.conf
# The server clause sets the main parameters.
server:
# Allow network connections outside of localhost
interface: 0.0.0.0
# Don't automatically run in the background because I want to be able to kill it without hunting a pid
do-daemonize: no
# TODO: Change this to your network range, like `192.168.0.0/16 allow`
access-control: 10.0.0.0/16 allow
# TODO: Change this to your username, or whatever user you want to run/own the `unbound` process
username: "bryanjswift"
@bryanjswift
bryanjswift / mail_virtual_users.rb
Created Feb 27, 2014
Process STDIN containing DB row sets from a command selecting email address and password hash. Used in pipeline like `ssh {{ main_user_name }}@{{ domain }} 'PGPASSWORD={{ mail_db_password }} psql -U {{ mail_db_username }} -h 127.0.0.1 --command="SELECT email, password FROM virtual_users;" {{ mail_db_database }}' | grep '\$6\$' | ./mail_virtual_u…
View mail_virtual_users.rb
#!/usr/bin/env ruby
require 'yaml'
# Part of command to sync down hashed user passwords
accounts = []
$stdin.each_line do |line|
email = line.split('|')[0].gsub(/\s+/, '')
hash = line.split('|')[1].gsub(/\s+/, '')
accounts << {
@bryanjswift
bryanjswift / Vagrantfile
Last active Feb 25, 2016 — forked from helloIAmPau/Vagrantfile
A file to install redis server onto an Ubuntu virtual machine.
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
You can’t perform that action at this time.