Skip to content

Instantly share code, notes, and snippets.

@panozzaj
panozzaj / gist:7868223
Created December 9, 2013 06:32
Random pulling of post ideas and printing to console
#!/usr/bin/env ruby
ideas = []
current_lines = []
lines = File.read('post_ideas.txt')
lines.split("\n").each do |line|
next if line.strip == ''
if line =~ /^==========/
if current_lines != []
@panozzaj
panozzaj / gist:5977024
Created July 11, 2013 16:35
documentup issue?
Given this document email_readme.md (equals signs not included):
===========================================
# Sample document
## More Help
Please send any questions or ideas on how this documentation can be improved to <a href="mailto:support@railsthemes.com">support@railsthemes.com</a>. Thanks!
===========================================
@panozzaj
panozzaj / gist:1329787
Created November 1, 2011 03:22
Bad Hipchat Chat Log Timestamps
Oct-30 3:38 PM
Oct-30 3:38 PM
Oct-30 3:39 PM
Oct-30 3:39 PM
Oct-30 3:40 PM
Oct-30 3:40 PM
Oct-30 3:40 PM
Oct-30 3:41 PM
Oct-30 3:41 PM
Oct-30 3:44 PM
@panozzaj
panozzaj / welcome_index_view
Created June 28, 2011 19:47
@baird_rt asked me what else I could be except for 'Definitely Alive!'
- if @last_tweet_time.nil? || @last_checkin_time.nil?
.header.hmm
Had problems querying services. Try again later.
- else
- last_action = @last_tweet_time > @last_checkin_time ? @last_tweet_time : @last_checkin_time
- if last_action > 2.hours.ago
.header.alive
Anthony is definitely alive!
- elsif last_action > 6.hours.ago
.header.alive
@panozzaj
panozzaj / diff_script
Created May 12, 2011 19:25
Word diff two markdown files in git and output the result formatted for Pandoc CSS
#!/bin/zsh
filename=$1
if [[ -z $filename ]] || [[ $filename == 'help' ]]
then
echo 'usage: diff_script file.markdown [old_revision] [new_revision]'
echo ' old_revision defaults to HEAD^'
echo ' new_revision defaults to current file (HEAD if unchanged)'
exit
fi
zsh + couchdb:
alias uuid="curl -s http://127.0.0.1:5984/_uuids | sed s/'^.*\\['// | sed s/'].*'// | sed s/'\"'//g | sed s/','/' '/g"
Then use `uuid` to put in a uuid. This is useful for local curl'ing.
Example:
> curl -X PUT -d '{"hello": "world"}' http://127.0.0.1:5984/mydb/`uuid`
Works with Ruby 1.8.7, but not Ruby 1.9. This could have been a problem because I manually installed Ruby 1.9.
I would guess this is a bug in fileutils, a Windows-related problem, or some combination thereof.
#####
# test.rb
require 'fileutils'
filenames = ARGV
" function for working with files with hard line breaks
cabbr eighty call Eighty()
fun! Eighty()
let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1) " highlight any line > 80 characters
set textwidth=80
colo neon
endfu