Skip to content

Instantly share code, notes, and snippets.

Avatar

Joe Chrysler joechrysler

  • Atomic Object
  • Grand Rapids, Michigan
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am joechrysler on github.
  • I am joechrysler (https://keybase.io/joechrysler) on keybase.
  • I have a public key whose fingerprint is 71C8 5928 84FB 0525 82DB 61EA 5741 DED0 F064 E9A9

To claim this, I am signing this object:

@joechrysler
joechrysler / move_completed_reminders_to_dayone
Last active Dec 27, 2015
SCRIPT to move completed reminders into a DayOne journal
View move_completed_reminders_to_dayone
on run {input, parameters}
tell application "Reminders"
if (count of (reminders whose completed is true)) > 0 then
set todoList to reminders whose completed is true
repeat with itemNum from 1 to (count of (reminders whose completed is true))
set reminderObj to item itemNum of todoList
set nameObj to name of reminderObj
set compDateObj to completion date of reminderObj
if (body of reminderObj) is not "" and (body of reminderObj) is not missing value then
set bodyObj to " Notes: " & body of reminderObj
View gist:8479938
git checkout -b new_branch # make the new branch so you don't lose commits
git push origin new_branch:new_branch # push your new branch to github so github doesn't lose commits
git checkout master # switch to master so that you're resetting master, not your new branch
git reset --hard cbedd62 # move master back to the last commit it should be on
git checkout master # you should be at the old commit.
git push -f origin master:master
View weirdness.sh
#!/usr/bin/env bash
mkdir weirdness
cd weirdness
git init
echo "hello" > file
git add file
git commit -m "add file"
echo ''
View for_jeff.html
<script>
window.onload = function (e) {
var my_image = document.getElementById("image_id"); // Get a reference to the image tag
var d = new Date(); // Instantiate a new date object
if (d.getDay() == 3) { // Sunday = 0, Monday = 1, etc... // If today is Wednesday
my_image.src = "path/to/other/image.png"; // Change the image's src attribute
}
}
</script>
View pep8-break.py
# In our codebase, we do a lot of this:
if some_really_long_boolean
and another_really_long_boolean
and a_third_really_long_boolean:
print "Yehaw!"
# PEP8 says we should probably be writing thusly
if some_really_long_boolean and
another_really_long_boolean and
a_third_really_long_boolean:
@joechrysler
joechrysler / who_is_my_mummy.sh
Last active Jan 28, 2022
Find the nearest parent branch of the current git branch
View who_is_my_mummy.sh
#!/usr/bin/env zsh
git show-branch -a \
| grep '\*' \
| grep -v `git rev-parse --abbrev-ref HEAD` \
| head -n1 \
| sed 's/.*\[\(.*\)\].*/\1/' \
| sed 's/[\^~].*//'
# How it works:
@joechrysler
joechrysler / ping-pong.rb
Created May 16, 2012
Playing with redis migrations
View ping-pong.rb
require "rubygems"
require "redis"
origin = Redis.new(host: '127.0.0.1', port: 6379)
destination = Redis.new(host: '127.0.0.1', port: 6380)
500.times do |i|
origin.set(i, "value#{i}")
end
@joechrysler
joechrysler / gist:2580265
Created May 2, 2012
Pushing mercurial repositories to github
View gist:2580265

Pushing mercurial into github

a guide for sceptic's

It's easy they said. Distributed SCMs are all basically the same they said, so transitioning from one to the other is super easy. So easy that in the time it's taken to write this sentence, you should have already installed a plugin and pushed your mercurial repo up to github right?

Lies. Horrible horrible lies.

The mercurial to git conversion is nothing short of a pain. Documentation is spotty and full of that peculiarly glib variety of optimism found most often at fast food eateries and VC-funded startups. But you know that already. That's why you're here after all.

Is all lost?

no. you can escape the plastic land of hg and enter the land of gritty git goodness.

@joechrysler
joechrysler / atomic_lines
Created Jan 11, 2012
Move lines of code around using vim's directional keys
View atomic_lines
" Pop the following into your .vimrc
" Move a line of text using CTRL+[arrows]
nmap <C-down> mz:m+<cr>`z
nmap <C-up> mz:m-2<cr>`z
nmap <C-left> <<
nmap <C-right> >>
vmap <C-down> :m'>+<cr>`<my`>mzgv`yo`z
vmap <C-right> :m'<-2<cr>`>my`<mzgv`yo`z
"" Move around split windows with CTRL+[jkhl]