Skip to content

Instantly share code, notes, and snippets.

@jrr
jrr / EXPMatchers+equalInAnyOrder.h
Created December 21, 2014 05:11
Expecta NSArray-as-NSCountedSet matcher
#import "Expecta.h"
EXPMatcherInterface(equalInAnyOrder, (id expected));
// 1st argument is the name of the matcher function
// 2nd argument is the list of arguments that may be passed in the function
// call.
// Multiple arguments are fine. (e.g. (int foo, float bar))
import Ember from 'ember';
export default Ember.Component.extend({
});
@jrr
jrr / smallcam.user.js
Last active May 11, 2020 01:00
Nest Cam Enhancements
// ==UserScript==
// @name Nest Cam Smallerizer
// @namespace https://github.com/jrr
// @version 0.2
// @description make camera more usable in small windows
// @author jrr
// @match https://home.nest.com/camera/*
// @match https://home.nest.com/home/*
// @grant none
// ==/UserScript==
@jrr
jrr / custom-qunit-assertions.js
Created November 10, 2016 02:43
custom qunit assertions
import QUnit from 'qunit';
QUnit.assert.contains = function( haystack, needle, message ) {
var result = haystack.indexOf(needle) > -1;
this.pushResult( {
result: result,
actual: haystack,
expected: needle,
message: message || `'${haystack}' contains string '${needle}'`
});
import Ember from 'ember';
export default Ember.Controller.extend({
_observeModel: Ember.observer('model', function(){
//console.log('model is',this.get('model'));
})
});
@jrr
jrr / controllers.application.js
Last active May 8, 2021 14:17 — forked from samselikoff/controllers.application.js
Mirage associated serializer?
import Ember from 'ember';
export default Ember.Controller.extend({
_observeModel: Ember.observer('model', function(){
//console.log('model is',this.get('model'));
})
});
@jrr
jrr / vsts-foobar-path.bat
Created June 21, 2017 19:00
find an executable from a VSTS build task
@echo off
Powershell.exe -executionpolicy remotesigned -File "%~dp0\vsts-foobar-path.ps1"
set /p foobarPath=< foobar-path.txt
PATH=%PATH%;%foobarPath%
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@jrr
jrr / backup-remote-db.sh
Last active April 18, 2022 13:12
Postgres clone
#! /usr/bin/env bash
if [[ -z "${DB_PASSWORD}" ]]; then
echo "Please set a DB_PASSWORD environment variable in order to connect to the RDS Database."
echo "You may be able to retrieve it with:"
echo " aws secretsmanager get-secret-value --secret-id arn:aws:secretsmanager:xx:xx:xx:xx"
exit 1
fi
if [[ -z "${DB_SSH_KEY}" ]]; then
@jrr
jrr / Single Gremlin Query from CLI.md
Last active February 3, 2021 22:20
Single gremlin query from command line.md

I was looking for the easiest way to execute a single gremlin query from the command line, and cobbled this together using the gremlin console:

To use:

  • docker-compose up to fire up a local Tinkerpop
  • ./gremlin.query.sh host "query"

Example:

> ./gremlin-query.sh localhost "g.addV('foobar')"
WARNING: An illegal reflective access operation has occurred