Skip to content

Instantly share code, notes, and snippets.

Jeff Kreeftmeijer jeffkreeftmeijer

Block or report user

Report or block jeffkreeftmeijer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View 4.2.6.rb
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', '4.2.6'
View README.md

git-run_guide

Generates the README for git-run.

$ git clone git@gist.github.com:cd37a464bded117bfce0.git git-run_guide
$ git clone git@gist.github.com:c4bef77ec0ebf1f2639f.git git-run_guide/examples
$ cd git-run_guide/examples
$ guidedown ../guide.md
@jeffkreeftmeijer
jeffkreeftmeijer / check_urls
Created Oct 17, 2015
`$ check_urls **/*.md`
View check_urls
#!/usr/bin/env ruby
URL_REGEX = /\b(([\w-]+:\/\/?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|\/)))/
contents = ARGF.read
matches = []
contents.scan(URL_REGEX) do |match|
matches << match.first
end
View oranges.css
body{
font-family: 'SF UI Display', 'Myriad Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;
color: #333333;
font-size: 18px;
line-height: 26px;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
}
@jeffkreeftmeijer
jeffkreeftmeijer / turn_back_the_hands_of_time.rb
Created Jan 23, 2015
♫ If I could turn, turn back the hands of time ♫
View turn_back_the_hands_of_time.rb
puts "♫ If I could turn, turn back the hands of time ♫"
puts "♫ Then my darlin' you'd still be mine ♫"
class Time
def self.now
Time.new(2015, 1, 23)
end
end
View options.rb
# Option 1
info = if publication
"Title: #{ publication.title } (ID: #{ publication.id })"
else
'N/A'
end
# Option 2
info = case publication
when Publication then puts "Title: #{ publication.title } (ID: #{ publication.id })"
View frame.html
<html>
<head>
<style>
a{
display: block;
margin: 2em 1em;
}
</style>
</head>
<body>
View token.rb
module Concerns::Token
def self.included(base)
base.after_initialize(:set_token)
end
def set_token
self.token = SecureRandom.hex if new_record?
end
end
You can’t perform that action at this time.