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
// This is a Jest spec that explores some of the different ways to alter | |
// arrays and objects without mutating state. I'm trying different approaches | |
// available using: | |
// | |
// * Vanilla JS | |
// * Immutable.js | |
// * Lodash | |
// * Rambda | |
// | |
// The motivation for this is largely to work with a Redux store. |
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 | |
# iBeacon Scanner | |
# refactored script from Radius Networks referenced in this StackOverflow answer: | |
# http://stackoverflow.com/questions/21733228/can-raspberrypi-with-ble-dongle-detect-ibeacons?lq=1 | |
# Process: | |
# 1. start hcitool lescan | |
# 2. begin reading from hcidump | |
# 3. packets span multiple lines from dump, so assemble packets from multiline stdin | |
# 4. for each packet, process into uuid, major, minor, power, and RSSI |
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
convert my-image.png -define icon:auto-resize=128,64,48,32,16 favicon.ico |
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
#!/usr/bin/env node | |
// Using the firebase-admin approach where database security rules do not apply. | |
// Here you are authenticating with a private key. The key JSON file is available via | |
// the Firebase web UI: project settings > service accounts > generate new private key. | |
var admin = require("firebase-admin"); | |
admin.initializeApp({ | |
credential: admin.credential.cert(".adminServiceAccountKey.json"), |
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
const newCharacters = Object.assign(characters, { [maude.id]: maude }); |
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
require 'test_helper' | |
class FoosControllerTest < ActionDispatch::IntegrationTest | |
setup do | |
@foo = foos(:one) | |
end | |
test "should get index" do | |
get foos_url | |
assert_response :success |
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
// You don't need to type cast the integer `deleteId` to a string in the | |
// browser, but when running Jest specs, I found that I had to cast to a | |
// string. Maybe this is a difference between browser JS and Node, which | |
// the tests run in? | |
const { [`${deleteId}`]: deleted, ...newCharacters } = characters; |
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 | |
# Colorizing Go test output: | |
# This is meant to be used in place of `go test`. Provided this script is in | |
# your PATH, calling `color-go-test` will call through to `go test` and then | |
# colorize and reformat the output. | |
RED=$(tput setaf 1) | |
GREEN=$(tput setaf 2) | |
YELLOW=$(tput setaf 3) |
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
const newCharacters = [...characters, "Maude"]; | |
stateChanges.push(newCharacters); | |
// stateChanges: | |
// [ | |
// ["Walter", "Jeffrey", "Donald"], | |
// ["Walter", "Jeffrey", "Donald", "Maude"], | |
// ] |
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
characters.push("Maude"); | |
stateChanges.push(characters); | |
// stateChanges: | |
// [ | |
// ["Walter", "Jeffrey", "Donald", "Maude"], | |
// ["Walter", "Jeffrey", "Donald", "Maude"], | |
// ] |
NewerOlder