Skip to content

Instantly share code, notes, and snippets.

View knice's full-sized avatar

Rob Knight knice

View GitHub Profile
@knice
knice / velocity-list-atom-titles.vm
Created February 16, 2012 17:34
Atom 1.0 Velocity Script
## Get atom feed from a feed block
#set ($feed = $_XPathTool.selectSingleNode($contentRoot,"/feed"))
## Try to get entries from that feed
#set ($entries = $feed.getChildren())
<ul>
<li>Feed name: $feed.getName()</li>
<li>Size of Entries array: $entries.size()</li>
<li>Feed namespace URI: $contentRoot.namespace.URI</li>
</ul>
@knice
knice / rss-atom.xsl
Created April 7, 2012 00:01
XSLT to create RSS feed from news articles
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:hh="http://www.hannonhill.com/XSL/Functions" xmlns:media="http://search.yahoo.com/mrss/" xmlns:xalan="http://xml.apache.org/xalan">
<xsl:output cdata-section-elements="atom:content"/>
<xsl:include href="/formats/Format Date"/>
<xsl:variable name="indexPageName" select="'index'"/>
<xsl:variable name="callingPage" select="/system-index-block/calling-page/system-page"/>
<xsl:variable name="current-date" select="/system-index-block/@current-time"/>
<xsl:variable name="news-categories" select="//calling-page/system-page/dynamic-metadata[starts-with(name,'category-')]/value"/>
<xsl:variable name="file_extension">.html?utm_medium=feed</xsl:variable>
@knice
knice / email-regex
Created December 19, 2012 17:42
Regular expression for capturing email addresses
([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)
@knice
knice / terminal-find-move.txt
Last active December 10, 2015 03:38
Find files with a string and move to another directory.
grep -l 'STRING' * | xargs -I '{}' mv '{}' DIRECTORY
@knice
knice / mac-network-check.sh
Created February 12, 2013 15:58
Look for and connect to WiFi network.
#!/bin/bash
## This script checks to see if the Mac is connected to
## a particular network. If it isn't, the script shuts off
## the wifi radio and turns it back on, then attempts
## to connect to the specified network.
##
## You can run this script at regular intervals with
## an app called Lingon, which utilizes launchd.
## Just make sure to chmod -x the script first.
@knice
knice / stylish-santacruzsentinel.css
Created February 28, 2013 21:57
santacruzsentinel.com styles for the Stylish Chrome extension.
@import url(http://fonts.googleapis.com/css?family=Roboto+Condensed:400,700);
.twitter-share-button,
#fb-root,
.TLBox,
.forum_v2_pagecontent,
.articlePositionFooter,
.articleFooterLinks,
#recommender,
#breakingburner-iframe,
@knice
knice / stylish-hacker-news.css
Created November 3, 2013 04:38
Stylish Hacker News
body {
margin: 0;
}
body > center > table {
width: 100%;
background-color: transparent;
}
@knice
knice / rainbow-banner.md
Last active June 2, 2021 22:13 — forked from anonymous/untitled
How we added a rainbow banner to the top of the UCSC homepage.

How we added a rainbow stripe to the top of the UCSC home page on June 26, 2015

  • I grabbed the colors from the rainbow banner on A List Apart.
  • We added this to the <head>:
<style type="text/css">

body {
 position: relative;
@knice
knice / Rakefile
Created November 5, 2015 04:55
Jekyll Rakefile from jekyll-template
task :default => :server
desc 'Clean up generated site'
task :clean do
cleanup
end
desc 'Build site with Jekyll'
task :build => :clean do
jekyll('build')
@knice
knice / rittenhouse.scpt
Last active November 5, 2015 22:10
Tell the Rittenhouse screen to activate, load a URL, and go into full screen mode
tell application "Google Chrome"
activate
-- 1. Close all windows
-- 2. Open a new window
set chromeWindow to window 1
tell chromeWindow
-- 1. Go to: http://s.codepen.io/knice/debug/NGYNXd
-- 2. Enter presentation mode
end tell
end tell