Skip to content

Instantly share code, notes, and snippets.

@robotdana
robotdana / Gemfile
Last active August 10, 2022 05:14 — forked from beccasaurus/Gemfile
Double checking that Capybara's RSpec matchers work as advertised
source 'https://rubygems.org'
gem "rspec"
gem "capybara"
gem "selenium-webdriver"
gem "webdrivers"
gem 'puma'
@robotdana
robotdana / dont_sit_in_silence.sh
Last active August 4, 2022 04:44
Don't sit in silence
#!/usr/bin/env bash
# whenever you find yourself sitting in silence after a zoom meeting or etc
# it will give a notification you can click to play whatever was last playing in spotify
# it _shouldn't_ pop up while in a meeting?
if ! which alerter; then
brew install alerter
fi
<!doctype html>
<html>
<head>
<title>shows</title>
<meta charset="utf8" />
<script>
function setItem(name, value) {
localStorage.setItem('robotdana.' + name, JSON.stringify(value))
}
@robotdana
robotdana / git_rename.sh
Last active July 22, 2022 06:00
Use git .mailmap
#!/bin/bash
# based on: https://gist.github.com/octocat/0831f3fbd83ac4d46451#gistcomment-2178506
# will use the .mailmap file to rewrite all names/emails
function correct_names () {
( git shortlog -sen ; git shortlog -secn ) | cut -f2 | sort | uniq
}
function all_names () {
( git log --format="%an <%ae>" ; git log --format="%cn <%ce>" ) | sort | uniq
@robotdana
robotdana / hang_quotes.js.coffee
Created June 27, 2014 13:28
Hanging Punctuation
$.fn.hangQuotes = (fname) ->
quote = /(?:(^|\s)([`'"“”‘’«»‹›]+)|([`'"“”‘’«»‹›]+)($|\s))/g
replacement = '$1<span class="hq">$2$3</span>$4'
className = 'hq'
exclude = 'code,table'
el = this
wrapQuotes = ->
$(el).textNodes().each ->
@robotdana
robotdana / First person.markdown
Last active December 26, 2015 22:08
Hope - writing test.

Ow.

Though my 'ow', didn't escape my mind. Nothing but a quick involuntary breath.

"Ok, blood is done. now, Iris, I want you to press your hand as hard as you can against this pad, can you do that for me?"

Yes, of course I can, old man. I'm not 12.

"Ok Doc."

var comments;
$.fn.getComments = function(data) {
var template = data.template;
data.template = undefined;
var container = $(this).empty();
data['thread:link'] = $('link[rel=canonical]').attr('href');
data.limit = 100;
data.order = 'asc';
$.getJSON('http://disqus.com/api/3.0/threads/listPosts.json', data, function(response){
@robotdana
robotdana / hang_quotes.js
Created August 16, 2012 12:19
Hanging Punctuation
<html>
<head>
<meta charset="utf8" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
$(function(){
$('article').find('h1,h2,h3,h4,h5,h6,p,blockquote,li').hang_quotes();
});
</script>
<style>
// watches a text input/area and triggers a change event as soon as it changes. Doesn't wait for blur.
// Doesn't loop unless a relevant element is focused
(function($){
$.fn.extend({
val_change: function(callback){
var interval;
var $this = $(this);
$this.focus(function(){
val last_val, current_val;
(function($){
$.fn.extend({
unslice: function(min, max){
/* returns a jQuery object containing whatever elements
would've been ditched if we'd done a slice() with the same parameters */
if ($(this).length && min !== undefined){
var before = min > 0 ? $(this).slice(0, min) : {};
var after = max !== undefined ? $(this).slice(max) : {};
return $(this).pushStack(after.add(before), "unslice");
}