Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
$ cat Procfile | |
foreman: foreman start -c web=1 worker=10 -f Procfile2 | |
$ cat Procfile2 | |
web: bundle exec rails s -p $PORT thin | |
worker: ruby worker.rb |
#!/usr/bin/ruby | |
# Some bash-fu should be able to do the same but I'm only a white belt | |
if ARGV.length < 1 | |
$stderr.puts 'usage: lostfind <keyword> [<keyword> ...]' | |
else | |
reflog = `git reflog` | |
reflog.each_line do |line| | |
hash, _, message = line.split(' ', 3) |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
require 'time' | |
require 'benchmark' | |
time = Time.now.iso8601(3) | |
# => "2014-05-26T23:26:08.628-07:00" | |
Benchmark.bm do |x| | |
x.report('parse') { 100_000.times { Time.parse(time).gmtime } } | |
x.report('iso8601') { 100_000.times { Time.iso8601(time).gmtime } } | |
end |
To use: create a new bookmark and paste into the URL field. | |
In Chrome, you can paste the full multiline code as shown below. | |
In other browsers, you may need to minify the code into one line first. |
curl
to get the JSON response for the latest releasegrep
to find the line containing file URLcut
and tr
to extract the URLwget
to download itcurl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
macro memoize(type_decl, &block) | |
@{{type_decl.var}} : {{ type_decl.type }} | UninitializedMemo = UninitializedMemo::INSTANCE | |
def {{type_decl.var}} | |
if (value = @{{type_decl.var}}).is_a?(UninitializedMemo) | |
@{{type_decl.var}} = begin | |
{{block.body}} | |
end | |
else | |
value |
#Model | |
expect(@user).to have(1).error_on(:username) # Checks whether there is an error in username | |
expect(@user.errors[:username]).to include("can't be blank") # check for the error message | |
#Rendering | |
expect(response).to render_template(:index) | |
#Redirecting | |
expect(response).to redirect_to(movies_path) |