osascript -e 'tell app "iTunes" to set sound volume to sound volume +20'
osascript -e 'tell app "iTunes" to next track'
osascript -e 'tell app "iTunes" to previous track'
osascript -e 'tell app "iTunes" to playpause'
osascript -e 'tell app "iTunes" to play'
osascript -e 'tell app "iTunes" to pause'
osascript -e 'tell application "iTunes" to return name of current track'
osascript -e 'tell application "iTunes" to set song repeat of current playlist to one'
osascript -e 'tell application "iTunes" to set shuffle of current playlist to not shuffle of current playlist'
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
class BarMixin { | |
} | |
Date.mixin(BarMixin) | |
100.times { | |
println "#${it + 1}" | |
def bar = new Date() | |
bar.toString() | |
sleep 100 |
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
*.mp3 |
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 'active_record' | |
require 'mysql2' | |
require 'capybara' | |
require 'rspec' | |
require 'capybara/rspec' | |
include Capybara::DSL | |
Capybara.default_driver = Capybara.javascript_driver |
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
class MyGrailsViewResolver extends GrailsViewResolver { | |
@Override | |
protected View loadView(String viewName, Locale locale) { | |
new MyView(super.loadView(viewName, locale)) | |
} | |
static class MyView implements View { | |
def View view |
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
// Written for Advanced Scraping (http://blog.dtrejo.com/scraping-made-easy-with-jquery-and-selectorga) | |
// by David Trejo | |
// | |
// Install node.js and npm: | |
// http://joyeur.com/2010/12/10/installing-node-and-npm/ | |
// Then run | |
// npm install jsdom jquery http-agent | |
// node numresults.js | |
// | |
var util = require('util') |
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
public String convertToString(GPathResult doc) { | |
def defaultNamespace = doc.lookupNamespace('') | |
if (defaultNamespace) { | |
def docWithNamespace = { | |
mkp.declareNamespace("": defaultNamespace) | |
out << doc | |
} | |
return new StreamingMarkupBuilder().bind(docWithNamespace) | |
} else { |
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
public void _glom(Stack<String> stack, String...a) { | |
if (a.length == 0) { | |
if (stack.peek() == "") { | |
stack.pop(); | |
} | |
return; | |
} | |
String s = a[0]; | |
if (s != "") { |
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
public List<String> glom(String...a) { | |
Stack<String> stack = new Stack<String>(); | |
stack.push(""); | |
for (String s : a) { | |
if (s != "") { | |
stack.push(stack.pop() + s); | |
} else { | |
if (stack.peek() != "") { | |
stack.push(""); |
This script will open a new Terminal tab at the current directory or another directory relative to the current directory. Assuming tab.sh is somewhere in your PATH. For example I saved it in my ~/bin then you can just do:
tab.sh
tab.sh ../another_project
NewerOlder