Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am chrislloyd on github.
  • I am chrislloyd (https://keybase.io/chrislloyd) on keybase.
  • I have a public key whose fingerprint is F429 4503 004C A9DF 1206 6DEE 53CE DF0A 6BDC 0B31

To claim this, I am signing this object:

@chrislloyd
chrislloyd / readme.md
Last active August 29, 2015 13:56
Flat tab bar for Atom

Use this css to disable the ugly skew-tabs that Atom ships with:

preview

require 'openssl'
class Webhooks::MailgunController < ApplicationController
skip_before_filter :verify_authenticity_token
before_filter :verify_webhook
def create
Librato.increment('webhook.mailgun.total')
case params['event']
“If something has a title, don’t use <h1>, use <div class="title”>” —wait, why? http://chrislloyd.com.au/post/54040765948/the-chris-lloyd-css-guide …

@mattrobs

Why I Hate HTML headings

Headings in HTML are like maintaining a numbered list of items in markdown:

  1. Foo
  2. Baz

Assembly CSS Styleguide

Here are some steps to CSS sanity. As always, this are guides, not rules. However, if you do find yourself breaking them ask yourself 5 whys. This usually leads to uncovering a misuderstanding of how CSS works or how a site's CSS works.

Read SMACSS

Never use ids

// This is bad

#foo-bar { }

/var/folders/nh/0vfgdp052_ngntv1_546c4tm0000gn/T/ruby-build.20130224115639.8902 ~
x openssl-1.0.1e/ACKNOWLEDGMENTS
x openssl-1.0.1e/apps/
x openssl-1.0.1e/apps/app_rand.c
x openssl-1.0.1e/apps/apps.c
x openssl-1.0.1e/apps/apps.h
x openssl-1.0.1e/apps/asn1pars.c
x openssl-1.0.1e/apps/ca.c
x openssl-1.0.1e/apps/ca-cert.srl
x openssl-1.0.1e/apps/CA.com
{ disableIndentCorrections = :true; }
#!/usr/bin/env ruby
require 'rest-client'
require 'nokogiri'
addresses = (1..10).inject([]) do |addresses, page|
$stderr.puts "fetching page #{page}"
html = RestClient.get 'http://mcserverlist.net/lists/top', params: {page: page}
doc = Nokogiri::HTML(html)
addresses += doc.css('.ip-and-port').map {|node| node.text.strip }
create_table :users, id: false do |t|
t.uuid :id, primary: true, null: false
# ...
end
@chrislloyd
chrislloyd / grp.rb
Created April 10, 2012 23:14
Handy grouping funtion
#!/usr/bin/env ruby
require 'active_support/core_ext'
abort("usage: #{__FILE__} day|week|month") unless %w(day week month).include?(ARGV[0])
$stdin.readlines.map {|l|
timestamp, amount = l.strip.split(',', 2)
[Time.at(timestamp.to_i), amount.to_i]
}.group_by {|(time, _)|
case ARGV[0]