Skip to content

Instantly share code, notes, and snippets.

Avatar

Rob Tarr robtarr

View GitHub Profile
@robtarr
robtarr / lodash-transform.js
Last active Dec 14, 2017
jscodeshift - replace `_.thing(...)` with `thing(...)` and add `import {thing} from 'lodash'`
View lodash-transform.js
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;
View transitionendEvents.js
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 Jul 25, 2015
Electric Imp Robot
View imp.js
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 Jul 25, 2015
Simple Johnny-Five demo
View robot.js
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() {
View circle.yml
test:
override:
- ./node_modules/.bin/gulp ci
@robtarr
robtarr / Wishlist
Created Oct 13, 2014
New Project Setup Wishlist
View 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 / presenters
Last active Aug 29, 2015
GemCityJS Lightning talks
View presenters
Jarrett Drouillard - @kuatsure
Chris Hamant - @chrishamant (Make)
Chuck Dascalos - @dascalos
John Weis - @weisjohn (Espruino|PhantomJS) (Not sure which yet)
@robtarr
robtarr / level 1
Created Apr 23, 2014
Ruby Warrior Levels - simple solutions
View level 1
class Player
def play_turn(warrior)
warrior.walk!
end
end
@robtarr
robtarr / geocode-script.js
Last active Aug 29, 2015
Code samples for Event Map Foundry post
View geocode-script.js
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 Apr 17, 2014
Geocoding script for Google Drive Spreadsheets
View geocode.gs
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;
}
You can’t perform that action at this time.