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 jruby | |
# | |
# | |
require 'rubygems' | |
require 'spoon' | |
EXEC = '/tmp/exec.rb' | |
PID_PATH = '/tmp/exec.pid' | |
WORK_PATH = '/tmp/' |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>comment</key> | |
<string> | |
TODO: unresolved issues | |
text: |
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
private static Node find(Node oldRoot, Node oldObject, Node newRoot) { | |
// Walk down the tree to locate oldObject, and in the process, pick the same child for newRoot | |
List<?extends Node> oldChildren = oldRoot.childNodes(); | |
List<?extends Node> newChildren = newRoot.childNodes(); | |
Iterator<?extends Node> itOld = oldChildren.iterator(); | |
Iterator<?extends Node> itNew = newChildren.iterator(); | |
while (itOld.hasNext()) { | |
if (!itNew.hasNext()) { | |
return null; // No match - the trees have changed structure |
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
import org.jruby.Ruby; | |
import org.jruby.runtime.Helpers; | |
import org.jruby.runtime.builtin.IRubyObject; | |
import org.jruby.javasupport.JavaUtil; | |
import org.jruby.RubyClass; | |
import org.jruby.RubyModule; | |
public class CallJRuby { | |
private static final Ruby __ruby__ = Ruby.getGlobalRuntime(); |
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
App = require('app') | |
App.PagesView = Em.View.extend | |
templateName: require('templates/pages') | |
click: (event) -> | |
# console.log event | |
elem = event.srcElement | |
x = event.pageX | |
y = event.pageY |
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 'stringio' | |
class Io | |
attr_accessor :instream, :outstream | |
def initialize(instream, outstream) | |
self.instream = instream | |
self.outstream = outstream | |
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
ext-jruby-local ~/projects/jruby $ jirb | |
irb(main):001:0> obj = java.lang.Object.new | |
=> #<Java::JavaLang::Object:0x7f6673fa> | |
irb(main):002:0> obj.getClass | |
=> class java.lang.Object | |
irb(main):003:0> _.class | |
=> Java::JavaLang::Class | |
irb(main):004:0> jcls = java.lang.Object.java_class | |
=> class java.lang.Object | |
irb(main):005:0> jmethod = jcls.declared_method(:getClass) |
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 | |
# | |
# Collection of pre-commit hooks | |
# | |
set -e | |
# Get directory of script file | |
ME=$0 | |
if [ -h ${ME} ]; then |
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/python | |
import logging | |
import re | |
import sys | |
import envoy | |
def _exec_git(cmd, args=''): | |
cmd = 'git {0} --color=never {1}'.format(cmd, args) |
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
;; 'val is the register where the return value of compiling goes | |
;; 'next is the requested type of compiler linkage, how the compiler will finish off the compiled code | |
;; 'return linkage returns to the state on top of the stack (to return from a function) | |
;; 'next linkage just continues onto whatever is the next instruction after the compiled instructions | |
;; any other linkage assumes a label, | |
;; i.e. (compile '(+ 1 2 3) 'val 'end) assumes 'end is a label somewhere,and jumps to it after calculating (+ 1 2 3) | |
(statements (ec-compile '(+ 1 2 3) 'val 'next)) ;; compile without inlining/open-coding | |
=> |