Skip to content

Instantly share code, notes, and snippets.

require 'open-uri'
require 'hpricot'
url = "http://www.lowes.com/webapp/wcs/stores/servlet/ProductDisplay?storeId=10151&catalogId=10051&productId=3200897"
cookie = "selectedStore1=Lowe's Of C Indianapolis## IN|0635|2|46220|no|Y|6002 North Rural Street|Indianapolis|M-Sa 6:30 Am - 10 Pm## Su 8 Am - 8 Pm|(317) 202-9142|(317) 202-9543|OA"
open(url, "Cookie" => cookie) do |f|
xml = Hpricot.XML(f)
text = (xml/"#buy-now").first.inner_text
if text =~ /Unavailable at LOWE'S OF C. INDIANAPOLIS/i
(defun my-indent-line ()
"Make single-semicolon lisp comments indent like ;;-comments.
Mostly cribbed from `lisp-indent-line'."
(interactive)
(let ((indent (calculate-lisp-indent)) shift-amt end
(beg (progn (beginning-of-line) (point))))
(skip-chars-forward " \t")
(if (or (looking-at "\\s<\\s<") (not (looking-at "\\s<")))
(lisp-indent-line)
(if (listp indent) (setq indent (car indent)))
; Patch package.el to correctly download certain packages on Windows.
+ (defun package-write-file-no-coding (file-name excl)
+ (setq buffer-file-coding-system 'no-conversion)
+ (write-region (point-min) (point-max) file-name nil nil nil excl))
(defun package-unpack-single (file-name version desc requires)
"Install the contents of the current buffer as a package."
(let* ((dir (file-name-as-directory package-user-dir)))
diff --git a/src/main/java/com/theoryinpractise/clojure/ClojureSwankMojo.java b/src/main/java/com/theoryinpractise/clojure/ClojureSwankMojo.java
index d792b10..7fb29b9 100644
--- a/src/main/java/com/theoryinpractise/clojure/ClojureSwankMojo.java
+++ b/src/main/java/com/theoryinpractise/clojure/ClojureSwankMojo.java
@@ -62,13 +62,13 @@ public class ClojureSwankMojo extends AbstractClojureCompilerMojo {
StringBuilder sb = new StringBuilder();
sb.append("(do ");
- sb.append("(swank.swank/start-server \"");
- sb.append(swankTempFile.getAbsolutePath());
@shoover
shoover / MarshalAction.cs
Created November 3, 2010 13:13
wraps an action in an asynchronous Post on the current synchronization context
// usage:
// // In a UI event handler:
// BarAsync(result => label.Text = result);
//
// void BarAsync(Action<int> completed) {
// completed = completed.Marshal();
// ThreadPool.QueueUserWorkItem(() => completed(42));
// }
//
// Here's what it replaces. You'd need one of these for each delegate type
@shoover
shoover / chromes.vbs
Created June 20, 2013 20:12
Load a URL in Chrome as a new tab in a specific user profile's window
' Load a URL in Chrome as a new tab in a specific user profile's window.
' usage: chromes PROFILE [URL]
' PROFILE can be a keyword to be translated in the lookup below.
Set oShell = CreateObject ("Wscript.Shell")
Dim profile, url, cmd, args
profile = WScript.Arguments(0)
Select Case LCase(profile)
# Exports all .org files in argument dirs as HTML.
#
# Usage: rake -f export-org-dirs.rb DIR+ [sync_mobile]
#
# sync_mobile (if not a dir) will fire off org-mobile-push and -pull if the
# mobile index is out of date wrt org files in dirs. This happens in the
# server so it saves your work and updates locally instead of behind your back
# and demanding a revert. It is advised to set this up to run only when the
# computer is idle so it doesn't go crazy while you're editing.
#
#!/bin/bash -e
#
# Purpose: Pack a Chromium extension directory into crx format
# From https://developer.chrome.com/extensions/crx#scripts, modified to take
# an output file argument.
if test $# -ne 3; then
echo "Usage: crxmake.sh <extension dir> <pem path> <crx out>"
exit 1
fi
@shoover
shoover / csx.rb
Last active August 29, 2015 14:19
A hacky C# script compiler runner
# C# script compiler and runner
#
# Hash headers at the top can be used to override default csc options. This is
# mainly for specifying references, but you can pass anything csc.exe takes.
# Extra plain .cs files should work if you put them last.
#
# References are tricky because practically they have to be in the application
# directory, which we stash away in HOME/.csx/something. Any reference csx can
# find (relative to the working directory) it will copy, which should work.
#
# Converts changesets bidirectionally between two repos, presumably between a
# subdirectory in a main repo and a separate project repo. The hg convert
# extension is used once in each direction. The convert extension's shamaps
# are tracked, so you need two of them plus two filemaps to map the file names
# between repos.
#
# Required args are paths and revisions for each repo. Revs are required to avoid
# syncing unwanted branches.
#
# An optional name is used as a suffix for all the map files. It defaults to