Skip to content

Instantly share code, notes, and snippets.

View jlogsdon's full-sized avatar

James Logsdon jlogsdon

View GitHub Profile
@jlogsdon
jlogsdon / adapters.application.js
Last active February 8, 2017 20:19 — forked from pangratz/adapters.application.js
pretender base
import Adapter from "ember-data/adapters/json-api";
export default Adapter.extend();
require 'minitest/autorun'
class ProcAndLambdaTest < Minitest::Test
def setup
@arr = [ 1, 2, 3 ]
end
def test_basic_return_behavior
# NOTE: Defining methods like this actually hoists them into the instance. I'm doing this purely
# for organization of the tests.
#!/usr/bin/env bash
# Usage: aws-tail [options] <tag-value> <file>
#
# Tail the same file on servers tagged with the given tag value. Each line is prefixed with the string "[$HOST_IP]"
# where $HOST_IP is the IP address the line came from. This file can be optionally filtered on the remote end to reduce
# transit data.
#
# Note that this is not perfect: output is not synchronized across connections which can lead to one line bleeding into
# another. For a general idea of what's going on, however, it works fantastic.
#
import React, { Component, PropTypes, cloneElement } from 'react';
import { debounce } from '../utils';
function elementSize(el) {
const bounds = el.getBoundingClientRect();
const styles = window.getComputedStyle(el);
const getAndParse = (prop) => parseFloat(styles.getPropertyValue(prop)) || 0;
const height = (bounds.height|0) + getAndParse('margin-top') + getAndParse('margin-bottom');

Usage:

$ merged-branches.sh > DELETE-ME # Get all merged branches on the origin remote and put them into the DELETE-ME file
$ branch-owners.sh < DELETE-ME | sort > BRANCH-OWNERS # Map all the branches we just grabbed to the most recent author
$ delete-branches.sh < DELETE-ME # Actually delete all of the branches from origin
$ stale-branches.sh # Logs stale branches (those older than 6 months) to STALE and the rest to FRESH
@jlogsdon
jlogsdon / gist:5f2cb81be8ce3e2cb4f8
Created August 6, 2015 14:18
This requires the `z` script: https://github.com/rupa/z (and this will only know about directories after you have visited it once, so do that before you can use this for a given path)
#!/usr/bin/env zsh
# Takes a single argument: a partial folder name. If no tmux session is active a new one is started; then we
# - `z $partial; nvim` in a fresh window
# - `z $partial` in a fresh window, left tab
# - `z $partial` in right tab of previous window
main() {
local new_session=0
tmux has-session 2> /dev/null
// Generated from a helper in my actual codebase
export default {
Todos: {
getAll: {
begin: 'Todos_getAll_begin',
end: 'Todos_getAll_end'
}
}
}
{
"manifest_version": 2,
"name": "Password Pwn",
"description": "This extension shows how insecure extensions can be",
"version": "1.0",
"content_scripts": [
{
"matches": ["<all_urls>"],
local gui=require 'gui'
local widgets=require 'gui.widgets'
tutorial_screen=defclass(tutorial_screen,gui.FramedScreen)
function tutorial_screen:init(args)
self:addviews{
widgets.Label{text="Info:",frame={t=1,l=1}},
widgets.Label{text="Other text: Text Text text",frame={t=2,l=2}},
jlogsdon@tapjoy % time rails runner 'puts Rails.root'
/Users/jlogsdon/Code/rails
rails runner 'puts Rails.root' 0.14s user 0.08s system 5% cpu 3.832 total
jlogsdon@tapjoy % time rails runner 'puts Rails.root'
/Users/jlogsdon/Code/rails
rails runner 'puts Rails.root' 0.13s user 0.07s system 46% cpu 0.425 total