Skip to content

Instantly share code, notes, and snippets.

View anoldguy's full-sized avatar

Nathan Anderson anoldguy

View GitHub Profile

Keybase proof

I hereby claim:

  • I am anoldguy on github.
  • I am mr_ndrsn (https://keybase.io/mr_ndrsn) on keybase.
  • I have a public key whose fingerprint is 21AD 56C0 2424 D3F4 9974 F368 87F5 06AD 08DB E511

To claim this, I am signing this object:

How Companies Communicated Being Hacked

It’s probably a pretty bad idea to have your site go down, when people are supposed to read the blog post explaining the hack.

Notice how another site reporting the hack received more attention than Twitter’s own announcement. Why was that?

@anoldguy
anoldguy / test.rb
Created May 29, 2013 17:42
SQL Injection?
# Is the following safe from SQL injection?
Model.where(Model.arel_table[:name].matches("%#{params[:q]}%"))
@anoldguy
anoldguy / gist:5256748
Created March 27, 2013 18:21
IE Compatibility Mode Fix
<!--[if HTML5]><![endif]-->
<!DOCTYPE html>
<!--[if lt IE 9]><html class="ie"><![endif]-->
<!--[if gte IE 9]><!-->
<html>
<!--<![endif]-->
<head></head>
<body></body>
</html>
@anoldguy
anoldguy / dummy.rb
Last active December 14, 2015 17:39
Rails Scope Blocks
class User < ActiveRecord::Base
# New way recommended by rails
has_many :membership_seasons, -> { uniq }, :through => :season_memberships, :source => :season
# The Deprecated Way, which seems much easier to read
has_many :membership_seasons, :through => :season_memberships, :source => :season, :uniq => true
end
@anoldguy
anoldguy / Fish-proposal.md
Last active December 14, 2015 00:19
My 10 year old writes a proposal for a pet fish.

May I Please Have a Fish?

Oh Dearest Mother and Father,

I would like to be responsible for owning six Neon Tetras.

I am world's most responsible 10 ½ year old boy. I work with Pop. I lift boards, hold boards when he is cutting and install lights. I also run my own business, Fox Trail Trash Service. I go around the block and I take out peoples large trash cans on Thursday and bring them back in after the trash truck comes on Friday. I spend my money wisely. I think about things before I start saving for them. I've thought about saving for fish for a long while and I thing it's a good idea.

All my siblings have owned pets. My older sister, for example, had a hermit crab named Scaredy Cat when she was nine. She begged and begged and begged for a long, long, long time for a rabbit and finally bought – with her own money – a rabbit that she named Star when she was 10. My younger brother and sister got hermit crabs when they were four and five. My younger sister has also had a rabbit named Easter when she was

{
"id": "rubygems",
"application": {
"staging": {
"rails_postgresql_host" : "33.33.33.12",
"rails_postgresql_db": "rubygems_staging",
"rails_postgresql_user": "rubygems",
"rails_postgresql_password": "totally insecure",
"s3_key": "",
"s3_secret": "",
.datepicker {
background-color: $white;
border-color: #999;
border-color: rgba(0, 0, 0, 0.2);
border-style: solid;
border-width: 1px;
@include border-radius(4px);
@include box-shadow(0 2px 4px rgba(0,0,0,.2));
@include background-clip(padding-box);

Setup

which ruby
(should return something like: ruby 1.9.3p194)
which gem
(should return something like: 1.8.23)

Installation

@anoldguy
anoldguy / create_dzi.rb
Created December 12, 2012 02:19
Example code from past projects. The ruby is from 2008-ish. The puppet is current, but sparse, as I'm just learning it.
#!/usr/bin/env ruby
$:.push("lib")
require 'image_science.rb'
require 'deep_zoom.rb'
file_options = { :format => 'png',
:quality => 80 }
slice_options = { :tile_size => 256,
:overlap => 4 }