Skip to content

Instantly share code, notes, and snippets.

View kattrali's full-sized avatar

Delisa kattrali

View GitHub Profile
class MoveNextLineCommand < DocumentCommand
def execute
doc = tab.edit_view.document
line_ix = doc.line_at_offset(doc.cursor_offset)
if line_ix == doc.line_count - 1
doc.cursor_offset = doc.length
else
doc.cursor_offset = doc.offset_at_line(line_ix + 1) - doc.delim.length
end
doc.ensure_visible(doc.cursor_offset)
package com.sporkmonger.rmud.swt.custom;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.LineStyleEvent;
import org.eclipse.swt.custom.LineStyleListener;
import org.eclipse.swt.custom.StyleRange;
@kattrali
kattrali / whazzup.rb
Created January 26, 2011 11:57 — forked from cyberfox/whazzup.rb
Asks for status every 15-25 minutes to track where time goes. Traps USR2 to wake and prompt for status. Designed for Linux, works on OS X, needs tweaks for Windows. Uses JRuby, since it's the only easy-to-get cross-platform UI toolkit for Ruby.
require "java"
java_import javax.swing.JOptionPane
class Whazzup
def initialize(file = "#{ENV['HOME']}/snippets.txt")
@snippets ||= open(file, 'ab')
log('[Starting up (ruby)]')
thread_loop = Thread.current
/**
* jQuery.support.cssProperty
* To verify that a CSS property is supported (or any of its browser-specific implementations)
*
* @param string p - css property name
* [@param] bool rp - optional, if set to true, the css property name will be returned, instead of a boolean support indicator
*
* @Author: Axel Jack Fuchs (Cologne, Germany)
* @Date: 08-29-2010 18:43
*
#export GRAILS_VERSION="$(ls -lhr $HOME/.grails | egrep -i '1\.' | head -1 | gawk '{print $9 }')"
export GRAILS_VERSION=`cat $GRAILS_HOME/build.properties | grep "^grails.version=" | awk -F= '{ print $2 }' | tr -d '\r' | tr -d '\n'`
_get_domain_classes(){
find ./grails-app/domain -iname *.groovy 2> /dev/null | tr \\n ' ' | sed 's/\.groovy//g' | sed 's/\.\/grails-app\/domain\///g' | tr '/' \.
}
_get_tests(){
find ./test -iname *.groovy 2> /dev/null | sed 's/\.\/test\/integration\///g' | sed 's/\Tests.groovy//g' | tr '/' \.
}
@kattrali
kattrali / bridge.rb
Created May 8, 2012 22:26 — forked from andreif/bridge.rb
bridgesupport
require "hpricot"
require "fileutils"
module BridgeSupport
class Parser
def initialize(path_from, path_to)
@doc = open(path_from) {|f| Hpricot(f).search('signatures').first}
if @doc and @doc.children
FileUtils.mkdir_p File.dirname(path_to)
o = open(path_to, 'w')
@kattrali
kattrali / gist:3004803
Created June 27, 2012 15:22 — forked from maddockpa/gist:3004769
Ajax and jquery get request
// target request:
// http://nominatim.openstreetmap.org/reverse?format=xml&lat=40.004&lon=-82.862&MaxResponse=1&zoom=17&accept-language=en-us&addressdetails=1
var getMyData = (function() {
var lat = document.forms[0].lat.value;
var lng = document.forms[0].lon.value;
return {format:"xml",lat:lat,lng:lng,MaxResponse:1,zoom:17,"accept-language":"en-us",addressdetails:1};
})
var submitForm = function() {
@kattrali
kattrali / a.md
Created June 29, 2012 12:52 — forked from rkh/a.md

This allows you to use the following video streaming services outside of the US from your Mac without having to use a proxy or VPN, so no big bandwidth issues:

  • Netflix
  • Hulu / HuluPlus
  • CBS
  • ABC
  • MTV
  • theWB
  • CW TV
  • Crackle
class MyGroupedListController < UIViewController
attr_accessor :posts
attr_accessor :sections
class TableViewSection
attr_accessor :title
attr_accessor :items
def initialize(params={})
@title = params[:title]
###
# Scheme code is translated to YARV byte code, then evaluated in the
# Ruby Virtual Machine
require 'rbconfig'
require 'dl'
require 'fiddle'
require 'strscan'
class RubyVM