Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am stonean on github.
  • I am stonean (https://keybase.io/stonean) on keybase.
  • I have a public key whose fingerprint is 5DE3 11CF A9C6 24CE 1E7A BAE6 EAA5 97CE F744 1B34

To claim this, I am signing this object:

@stonean
stonean / gist:5e33488c4f4cf2123c72
Created January 2, 2015 16:36
New web browser

This is a brain dump, many grammatical errors to follow ...

About a week ago I was chatting with my team about my technology choices for now (things will change) and the subject of Javascript arose. Obviously there's a lot of talk going on about Javascript, both good and bad, which frameworks to choose, the overall poor performance of the frameworks, etc... I've simply come to the conclusion that I'll only use Javascript when there's a clear UX win.

This got me thinking about Javascript in general and resurrected some older thoughts regarding the difficulty that still exists in web development. Difficulty that I think should not still exist.

So I was wondering why that is. I think it's that we are still dealing with an old foundation. Javascript is a language with many flaws and not one designed with security in mind. HTML has made some advancements with HTML5, but I think so much more could be done. CSS could use a lot more power/flexibility to reduce code duplication and help code reduction. Addressing a

@stonean
stonean / gist:46fee17f1e5da95e3e70
Created June 25, 2014 17:40
nginx: create SSL Certs
#!/usr/bin/env ruby
# Pass in the name of the site you wich to create a cert for
domain_name = ARGV[0]
if domain_name == nil
puts "Need a domain name, I can't read minds."
else
system "openssl genrsa -out #{domain_name}.key 2048"
system "openssl req -new -key #{domain_name}.key -out #{domain_name}.csr -subj '/C=US/ST=GA/L=Roswell/O=Nookwit/OU=IT/CN=#{domain_name}'"
@stonean
stonean / gist:5391419
Created April 15, 2013 21:28
states hash
states = {"AL"=>"Alabama", "AK"=>"Alaska", "AZ"=>"Arizona", "AR"=>"Arkansas", "CA"=>"California", "CO"=>"Colorado", "CT"=>"Connecticut", "DE"=>"Delaware", "FL"=>"Florida", "GA"=>"Georgia", "HI"=>"Hawaii", "ID"=>"Idaho", "IL"=>"Illinois", "IN"=>"Indiana", "IA"=>"Iowa", "KS"=>"Kansas", "KY"=>"Kentucky", "LA"=>"Louisiana", "ME"=>"Maine", "MD"=>"Maryland", "MA"=>"Massachusetts", "MI"=>"Michigan", "MN"=>"Minnesota", "MS"=>"Mississippi", "MO"=>"Missouri", "MT"=>"Montana", "NE"=>"Nebraska", "NV"=>"Nevada", "NH"=>"New Hampshire", "NJ"=>"New Jersey", "NM"=>"New Mexico", "NY"=>"New York", "NC"=>"North Carolina", "ND"=>"North Dakota", "OH"=>"Ohio", "OK"=>"Oklahoma", "OR"=>"Oregon", "PA"=>"Pennsylvania", "RI"=>"Rhode Island", "SC"=>"South Carolina", "SD"=>"South Dakota", "TN"=>"Tennessee", "TX"=>"Texas", "UT"=>"Utah", "VT"=>"Vermont", "VA"=>"Virginia", "WA"=>"Washington", "WV"=>"West Virginia", "WI"=>"Wisconsin", "WY"=>"Wyoming"}
@stonean
stonean / timer.js
Created February 17, 2012 23:05
Showoff Autorotate
$(document).ready(function(){
setInterval("nextStep()", 20000);
});
@stonean
stonean / gist:1110617
Created July 27, 2011 23:49
Potential Slim syntax for JSON output
/ Slim source
project Slim JSON
url = slim_url
contributors
- people
username = username
Where slim_url is a method that returns 'https://github.com/stonean/slim'
@stonean
stonean / gist:1063586
Created July 4, 2011 16:34
Rails 3 error display
# shared/errors.slim
- if model.errors.any?
ul#errors
- model.errors.full_messages.each do |msg|
li = msg
# posts/new.html.slim
= render partial: "/shared/errors", locals: { model: @post }
def meth(*args)
puts args.inspect
end
meth(1,2,3,4)
[1, 2, 3, 4]
meth([1,2,3,4])
[[1, 2, 3, 4]]
class Array
def sum
inject(0.0) { |result, el| result + el }
end
def mean
sum / size
end
end
<h1><%= header %></h1>
<% if not item.empty? %>
<ul>
<% for i in item %>
<% if i[:current] %>
<li><strong><%= i[:name] %></strong></li>
<% else %>
<li><a href="<%= i[:url] %>"><%= i[:name] %></a></li>
<% end %>
<% end %>