Skip to content

Instantly share code, notes, and snippets.

@henrik
henrik / rules.md
Last active May 23, 2022 12:31
Sandi Metz' four rules from Ruby Rogues episode 87. Listen or read the transcript: http://rubyrogues.com/087-rr-book-clubpractical-object-oriented-design-in-ruby-with-sandi-metz/
  1. Your class can be no longer than 100 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. When a call comes into your Rails controller, you can only instantiate one object to do whatever it is that needs to be done. And your view can only know about one instance variable.

You can break these rules if you can talk your pair into agreeing with you.

@textarcana
textarcana / centos-install-syntax-highlighting-in-less.sh
Last active May 1, 2023 01:01
2020 update: just use bat(1) instead!!!! bat has git integration and also can show invisible characters! OLD STUFF: How to enable syntax-highlighting in less. Use `less -N` (or type -N while in less) to enable line numbers. Based on the procedure described in http://superuser.com/questions/71588
# Enable syntax-highlighting in less.
# Last tested on CentOS 6.3.
#
# First, add these two lines to ~/.bashrc
# export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s"
# export LESS=" -R "
sudo yum -y install boost boost-devel ctags
wget http://springdale.math.ias.edu/data/puias/unsupported/6/x86_64/source-highlight-3.1.6-3.puias6.x86_64.rpm
@jszmajda
jszmajda / Readme.md
Created March 25, 2013 18:32
template loading in angular.js with rails

Basically the angular_templates helper method creates script tags like

<script type="app/x-angular-template" name="whichever_app/templates/foo">
  template code here as html with {{}}s etc
</script>

We then reference that in angular with jQuery via $("script[name='whichever_app/templates/foo']").html().

@csexton
csexton / posts.md
Last active December 17, 2015 17:29
Robust JSON

Accept json posts in the following formats:

POST /posts

jsonapi.org plural rooted document:

{"things":[{"name": "My Name", "location": "here"}]}
@elefontpress
elefontpress / gist:6159651
Last active June 12, 2024 22:48
This is the contract Bearded uses for client work on a time and materials basis. It's worked for us, but I am not a lawyer, so please run it by yours before you use it! Regardless, do whatever you like with it. Use it, share it, change it ... go nuts. Our original contract from 2008 was for fixed-price projects and was based on Andy Clark'e Cont…

Bearded's Hourly Contract

Date: [[Date of Document]] Between [Our Company] and [Your Company]

Summary

We’re not big on formality, but sometimes it’s best to have a few simple things written down so that we’re all on the same page. In this contract you won’t find complicated legal terms or large passages of unreadable text. We have no desire to trick you into signing something that you might later regret. We do want what’s best for the safety of both parties, now and in the future.

@csexton
csexton / coder-night.md
Created September 30, 2013 15:26
Arlington Ruby Coder Night

Draft for Arlington Ruby. Adapted from Tampa Ruby. And by "adapted," I mean "stolen."


tl;dr - CoderNight is to practice development. You write code in pairs or individually and submit the code to me. I post an anonymized repo and you have a week to look at all the solutions before a friendly night of code review.

NOTE: Please email me or ask in the IRC channel: #arlingtonruby on freenode if you have questions.

THIS MONTH'S PROBLEM SET: http://puzzlenode.com/puzzles/11-hitting-rock-bottom

@csexton
csexton / irc-cheat-sheet.md
Last active December 25, 2015 07:49
IRC Cheat Sheet for #arlingtonruby

So you can be an op, you need to register, you can do that by running this command:

/msg nickserv register your_password your_email_address

To become an operator on #arlingtonruby:

/msg chanserv op #arlingtonruby

To make someone an op:

@bokmann
bokmann / triangle_peg.rb
Last active June 14, 2016 18:57
An example from "What Computer Scientists Know: Thinking Recursively, Part 2. In this example we are going to explore how we use our newfound knowledge of recursion to search through all the solutions of a simple puzzle using recursive backtracking.
# This is a programming chellenge from David Bock's series
# "What Computer Scientists Know". This is a problem that can
# be used to discuss a bunch of computer science topics, but
# as I'm providing most of the skeleton of the solution, the
# point of this exercise is to demonstrate 'recursive backtracking'.
# http://en.wikipedia.org/wiki/Backtracking
# this problem is based on the classic 'triange peg game', a common
# sight in roadside diners in America, in particular, Cracker
@ungoldman
ungoldman / dokku_setup.md
Last active November 28, 2023 12:35
Deploy your own PaaS: Setting up Dokku with DigitalOcean and Namecheap

Deploy your own PaaS!

Setting up Dokku with DigitalOcean and Namecheap

..or how I made my own heroku in a few hours for $3.98.


This write-up is several years out of date! You probably shouldn't use it.

#!/usr/bin/env ruby
input = "%clipboard"
subs = {
" " => " ",
"a" => "ɐ",
"b" => "q",
"c" => "ɔ",
"d" => "p",
"e" => "ǝ",