Skip to content

Instantly share code, notes, and snippets.

View robtarr's full-sized avatar

Rob Tarr robtarr

View GitHub Profile
@robtarr
robtarr / lodash-transform.js
Last active November 30, 2020 05:41
jscodeshift - replace `_.thing(...)` with `thing(...)` and add `import {thing} from 'lodash'`
export default (fileInfo, api) => {
const j = api.jscodeshift;
const methods = [];
const root = j(fileInfo.source);
const body = root.find(j.Program).get('body', 0).node;
const { comments } = body;
delete body.comments
root.get().node.comments = comments;
@robtarr
robtarr / transitionendEvents.js
Created July 11, 2016 14:26
CSS Animation Events
element.addEventListener('transitionend', function(e) {
let prop = e.propertyName.match(/border-(.*)-color/);
if (prop[1]) {
console.log(`Border color for ${prop[1]} transitioned`);
}
});
element.addEventListener('transitionend', function(e) {
if (e.propertyName === 'border-top-left-radius') {
@robtarr
robtarr / imp.js
Created July 25, 2015 17:32
Electric Imp Robot
var five = require('johnny-five'),
Imp = require("imp-io"),
keypress = require('keypress'),
board = new five.Board({
repl: false,
debug: false,
io: new Imp({
agent: 'FPKHeMBXeuim'
})
}),
@robtarr
robtarr / robot.js
Created July 25, 2015 14:38
Simple Johnny-Five demo
var five = require("johnny-five"),
keypress = require('keypress'),
board = new five.Board(),
stdin = process.stdin;
keypress(process.stdin);
stdin.setRawMode(true);
stdin.resume();
board.on("ready", function() {
test:
override:
- ./node_modules/.bin/gulp ci
@robtarr
robtarr / Wishlist
Created October 13, 2014 14:20
New Project Setup Wishlist
There are many things that we do to start projects - create a repo, setup dev/qa servers, etc. If you could automate some of this process, what would you include?
- GitHub Repo
- Slack Integration
- [CodeClimate](codeclimate.com)
- [CircleCI](circleci.com)
- Dev Server
- username/pass for us and client
- QA Server
- username/pass for us and client
@robtarr
robtarr / level 1
Created April 23, 2014 18:08
Ruby Warrior Levels - simple solutions
class Player
def play_turn(warrior)
warrior.walk!
end
end
@robtarr
robtarr / geocode-script.js
Last active August 29, 2015 13:59
Code samples for Event Map Foundry post
function geoCode(addr){
var gc = Maps.newGeocoder();
var geoJSON = gc.geocode(addr);
var lat = geoJSON.results[0].geometry.location.lat;
var lng = geoJSON.results[0].geometry.location.lng;
return lat + ", " + lng;
}
@robtarr
robtarr / geocode.gs
Created April 17, 2014 13:35
Geocoding script for Google Drive Spreadsheets
function geoCode(addr){
var gc = Maps.newGeocoder();
var geoJSON = gc.geocode(addr);
var lat = geoJSON.results[0].geometry.location.lat;
var lng = geoJSON.results[0].geometry.location.lng;
return lat + ", " + lng;
}
### Keybase proof
I hereby claim:
* I am robtarr on github.
* I am robtarr (https://keybase.io/robtarr) on keybase.
* I have a public key whose fingerprint is 964A 0CC8 1AD5 7FFB A73B 68E7 7049 CA37 8F8E 8717
To claim this, I am signing this object: