Want to create a Gist from your editor, the command line, or the Services menu? Here's how.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Creates a list of URLs to stdout based on repeating patterns found in the site, suitable for use with WGET or CURL. | |
""" | |
import datetime | |
scopes=[ | |
"aries", | |
"taurus", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Example of using the old BeautifulSoup API to extract content from downloaded html files into CSV... if you're doing this sort of thing today, I recommend using the newer lxml interface directly, but lxml also has a BeautifulSoup compatibility layer. | |
""" | |
import os | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
""" | |
Script to copy all bookmarks from Read It Later to Instapaper. | |
See also http://readitlaterlist.com/api/docs/#get | |
and http://www.instapaper.com/api/simple | |
""" | |
import urllib, urllib2, json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'omniauth/oauth' | |
require 'multi_json' | |
module OmniAuth | |
module Strategies | |
class Instapaper < OmniAuth::Strategies::XAuth | |
def initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block) | |
client_options = { | |
:title => 'Instapaper', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
Capistrano::Configuration.instance(:must_exist).load do | |
namespace :rails do | |
desc "Open the rails console on one of the remote servers" | |
task :console, :roles => :app do | |
hostname = find_servers_for_task(current_task).first | |
exec "ssh -l #{user} #{hostname} -t 'source ~/.profile && #{current_path}/script/rails c #{rails_env}'" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# on centos minimal | |
yum install gcc | |
yum install make | |
yum install ncurses-devel | |
yum install lua lua-devel | |
yum install ruby ruby-devel | |
yum install python python-devel | |
yum install perl perl-devel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# By Parker Moore, http://www.parkermoore.de/ | |
# Referenced the following URLs and compiled: | |
# http://lookherefirst.wordpress.com/2007/12/03/check-if-an-entry-is-a-file-or-directory-in-python/ | |
# http://stackoverflow.com/questions/845058/how-to-get-line-count-cheaply-in-python | |
import sys, os | |
def file_len(fname): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This this replacemnt for default rails field_with_errors for using http://www.yaml.de/docs/index.html#yaml-forms | |
# Add this to ./config/environment.rb file | |
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| | |
if html_tag =~ /<label/ | |
%|<div class="ym-error"><p class="ym-message">#{[instance.error_message].join(', ')}</p>#{html_tag}</div>|.html_safe | |
else | |
%|<div class="ym-error">#{html_tag}</div>|.html_safe | |
end |
Sometimes you want to have a subdirectory on the master
branch be the root directory of a repository’s gh-pages
branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master
branch alongside the rest of your code.
For the sake of this example, let’s pretend the subfolder containing your site is named dist
.
Remove the dist
directory from the project’s .gitignore
file (it’s ignored by default by Yeoman).
OlderNewer