Skip to content

Instantly share code, notes, and snippets.

@ttscoff
ttscoff / grab links.bookmarklet
Last active April 3, 2024 19:44
Create a bookmark and paste the code from `grab links.bookmarklet` into the url. Trigger it on a page containing links you want to save and then click the section of the page containing the links. A Markdown list of all links will be generated, and clicking the resulting list will select all for copying.
@marksim
marksim / tictactoe_spec.rb
Created June 15, 2013 03:18
My favorite TicTacToe implementation yet. Doing testing right results in better design.
require 'rspec'
class TicTacToe
def initialize
@x_moves = []
@o_moves = []
end
def play space
return false unless (1..9).include?(space)
@naoyamakino
naoyamakino / gist:5504445
Created May 2, 2013 18:53
Dissecting Ruby with Ruby via @schneems #railsConf
Code Triage: gemhttp://www.codetriage.com/
budle open gemName
puts caller.inspect #where it came from
object#method
object.method(:method_name).source_location
method.source_location
self.class.ancestors #get superclass names in order
@ttscoff
ttscoff / Raketimer.rb
Created February 13, 2013 14:59
Example Rakefile additions for Jekyll task timer and push notifications
# Rake file tricks for timing and notifying task completion
# at the top of the file with other config settings
run_time = Time.now
# quick function to determine diff between passed time and now
def finish_timer(start_time)
finish_time = Time.now - start_time
total_min = "%d" % (finish_time / 60)
@sdball
sdball / sandi_metz_rules_for_developers.md
Created January 18, 2013 18:47
Rules for good development from Sandi Metz

Sandi Metz’ rules for developers

  1. Your class can be no longer than a hundred lines of code.
  2. Your methods can be no longer than five lines of code
  3. You can pass no more than four parameters and you can't just make it one big hash.
  4. In your controller, you can only instantiate one object, to do whatever it is that needs to be done.
  5. Your view can only know about one instance variable.
  6. Your Rails view should only send messages to that object i.e., no Demeter violations.[ "thunder dome principal". Translated: one model in, one model out! ]
  7. Rules are meant to be broken if by breaking them you produce better code. [ ...where "better code" is validated by explaining why you want to break the rule to someone else. ]
@jbgo
jbgo / fix-vim-error576.md
Created November 28, 2012 15:03
Fixing VIM error "E576: viminfo: Missing '>' in line: ..."

I was getting the error E576: viminfo: Missing '>' in line: [file names] about ten times with various file names whenever I opened or saved a buffer in Vim. This happened both in normal vim and with MacVim. This was followed by the line E136: viminfo: Too many errors, skipping rest of file. Other than these obnoxious messages, Vim itself worked fine.

To fix it, I opened ~/.viminfo and deleted everything in the section labeled # History of marks within files (newest to oldest):. I lost all my history of marks within files, but that was acceptable for me since I was starting a new coding session for the day.

So far, I'm not sure how my viminfo got into this state.

@wcaleb
wcaleb / duesoon.sh
Created May 15, 2012 15:54
A shell script to remind me of tasks that are due soon, using this system: http://wcm1.web.rice.edu/plain-text-gtd.html
#!/bin/sh
TODAY=$(date +%m)
FILE=~/.duesoon
# This may be more complex than need be, but it permits months with or without leading zeroes
let THISMO=$TODAY-0
if [ $THISMO = 12 ]; then
let NEXTMO=01
else
@bmatheny
bmatheny / gist:1069547
Created July 7, 2011 13:49
Why I left Indy (but still think it's great)

Miles recently wrote a post on the Indy Hackers Blog appropriately titled, Why Indy? In the post (http://blog.indyhackers.org/post/7262445527/why-indy) Miles (along with several other hoosiers) enumerates the various great things about why a developer/business might want to live in/stay in/come to Indiana. Having spent 10 of my 31 years in Indiana (4 in West Lafayette, 6 in Indianapolis) I definitely think of myself as a hoosier but despite that I moved to NYC in May. I am in the defector group, but maybe not in the dissenter group.

While I was in Indianapolis I held leadership roles at 3 different startups including ChaCha and Compendium, witnessed a very successful exit at one of my startups (3GUpload.com in 2004), and consulted for a half-dozen other various companies. That is to say, I think I have a pretty good feeling for what Indy has to offer in terms of work. Additionally, I participated in a variety of volunteer organizations (Big Brothers Big Sisters, Leukemia/Lymphoma society, ADA, etc) as well a

@stammy
stammy / index.xml
Created January 25, 2011 15:00
RSS Feed for Jekyll (feed/index.xml) - paulstamatiou.com
---
layout: nil
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="text" xml:lang="en">{{ site.root_desc }}</title>
<link type="application/atom+xml" href="http://paulstamatiou.com/feed/" rel="self"/>
<link type="text" href="http://paulstamatiou.com" rel="alternate"/>
<updated>{{ site.time | date_to_xmlschema }}</updated>