Skip to content

Instantly share code, notes, and snippets.

@veered
veered / process_structured.rb
Created July 13, 2012 01:04
New structured data parser
def process_structured(event)
line = event.fields["tail"].first
properties, message = line.split("] ", 2)
properties.slice!(0)
properties.split("][").each do |group|
items = group.split
name = items.slice!(0).split("@", 2).first
@veered
veered / gist:4759121
Created February 12, 2013 01:01
This is the working config file
config defaultToCurrentScreen true
config windowHintsShowIcons true
config windowHintsIgnoreHiddenWindows false
config windowHintsSpread true
config windowHintsSpreadPadding 40
config windowHintsSpreadSearchWidth 80
config windowHintsSpreadSearchHeight 80
config switchIconPadding 2
config switchBackgroundColor 50;53;58;0.7
config switchSelectedPadding 4
@veered
veered / gist:4759131
Created February 12, 2013 01:02
This is the broken .slate
# Resize Bindings
bind right:alt resize +10% +0
bind left:alt resize -10% +0
bind up:alt resize +0 -10%
bind down:alt resize +0 +10%
bind right:ctrl;alt resize -10% +0 bottom-right
bind left:ctrl;alt resize +10% +0 bottom-right
bind up:ctrl;alt resize +0 +10% bottom-right
bind down:ctrl;alt resize +0 -10% bottom-right
Shoes.setup do
gem 'curb >= 0.8.3'
gem 'json >= 1.1.1'
end
require 'visual_objects'
Shoes.app do
background "#FFFFFF"
import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.util.ArrayList;
public abstract class Classifier {
public abstract Integer classify(DataPoint dataPoint);
public void test(String fileName) throws FileNotFoundException {
test(Main.parse(fileName));
@veered
veered / pascal.rb
Created April 9, 2013 22:54
Prints the first n rows of Pascal's Triangle
def next_row(row)
Array(0..row.size).map do |i|
(i > 0 ? row[i-1] : 0) + (i < row.size ? row[i] : 0)
end
end
def print_rows(n)
row = [1]
knife bootstrap IPADDRESS --sudo -x USERNAME -P PASSWORD -N “target1.local”
config defaultToCurrentScreen true
config windowHintsShowIcons true
config windowHintsIgnoreHiddenWindows false
config windowHintsSpread true
config windowHintsSpreadPadding 40
config windowHintsSpreadSearchWidth 80
config windowHintsSpreadSearchHeight 80
config windowHintsOrder leftToRight
config switchIconPadding 2
config switchBackgroundColor 50;53;58;0.7
require 'gosu'
require 'matrix'
class Green < Gosu::Window
def initialize
super 640, 480, false
self.caption = "Green Physics"
@box1 = Polygon.new(
@veered
veered / tracker.js
Last active May 28, 2019 22:12
Some bonus features for Tracker
// Only trigger enclosing computation if the return value of
// f is not EJSON.equals to the previuous return value
Tracker.guard = function(f) {
if (Meteor.isServer || !Tracker.currentComputation) {
return f();
}
let dep = new Tracker.Dependency(),
curView = Blaze.currentView,
tplFunc = Template._currentTemplateInstanceFunc;