Skip to content

Instantly share code, notes, and snippets.

@mbuckbee
mbuckbee / deepsearch.rb
Created December 11, 2010 20:08
Deep search a single twitter users's history.
require 'rubygems'
require 'twitter'
require 'json'
require 'net/http'
def term_search(screen_name, needle)
(0..9999999).each do |i|
puts "Page #{i} Search"
@mbuckbee
mbuckbee / QRCoding.html
Created December 19, 2010 19:34
How to Add a Secret QR Code to your blog posts
<!-- Place in your header after your current CSS declarations -->
<style type="text/css" media="screen">
#qrcode{display: none;}
</style>
<style type="text/css" media="print">
#header, #sidebar, #respond, .social-bar, .author-links, #footer, #comments{display: none;}
#qrcode{display: block;}
@mbuckbee
mbuckbee / nginx.conf
Created January 4, 2011 10:09
Wordpress with a Rails subdirectory
server {
listen 80;
server_name www.wordpress-domain-name.com;
root /var/www/wordpress;
index index.php;
try_files $uri $uri/ /index.php;
location /rails {
passenger_min_instances 2;
@mbuckbee
mbuckbee / boingboing_title_exporter.rb
Created January 31, 2011 07:06
Parses the BoingBoing JSON data dump pulling post titles and writing them to a new file.
require 'rubygems'
require 'yajl'
file = File.new('bbPosts.json', 'r') # file with more than one json
# Boing Boing Titles
parser = Yajl::Parser.new
parser.parse(file) do |file|
file.each do |post|
@mbuckbee
mbuckbee / reddit_post_scraper.rb
Created January 31, 2011 07:26
Queries the RSS/XML feeds of Reddit to save post titles to a file.
require 'rubygems'
require 'open-uri'
require 'nokogiri'
count = 0
def get_submissions(ident, count)
xml = Nokogiri::XML(open("http://www.reddit.com/new/.xml?count=25&after=t3_#{ident}"))
puts "\n\nhttp://www.reddit.com/new/.xml?count=25&after=t3_#{ident}"
@mbuckbee
mbuckbee / boingboing_classifier.rb
Created January 31, 2011 07:31
Bayesian classifier for training BoingBoing post recognition
require 'rubygems'
require 'classifier'
require 'madeleine'
m = SnapshotMadeleine.new("#{RAILS_ROOT}/bayes_data") {
Classifier::Bayes.new 'Boingable', 'Unboingable'
}
# Boing Boing Titles
@mbuckbee
mbuckbee / gist:974134
Created May 16, 2011 09:19
Dynamic iframe
function sendChatterMessage(sfdc_base_url, message_text){
$jquery('<iframe />', {
name: 'chatterFrame',
id: 'chatterFrame',
width: '800px',
height: '800px',
src: 'https://' + sfdc_base_url + '/_ui/core/chatter/ui/ChatterPage'
}).appendTo('body');
$jquery('#chatterFrame').load(function(){
@mbuckbee
mbuckbee / pgtuning
Created September 4, 2012 03:44
Postgres tuning
Set File system Read ahead to 4096
blockdev --setra 4096 /dev/sda1
Filesystem tests run at 256, 4096 and 8192 each tested with
bonnie++ -f -n 0 -c 4 -u root | bon_csv2html > ir-results-8192.html
Run /services/postgres-tuning/determine_postgres_memory.sh on machine (copy via SFTP)
<div class='ip-industry-lookup'>
<div data-industry='healthcare'>
Our hospital saved 10x
</div>
<div data-industry='construction'>
We built 50% more in 20% less time
</div>
@mbuckbee
mbuckbee / index.html
Last active July 19, 2020 19:58
Bootstrap Template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">