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
document.write('\x3c!-- Template Id \x3d 13,901 Template Name \x3d Banner Creative (Flash) - In Page Multiples - [DFA] --\x3e\n\x3c!-- Copyright 2006 DoubleClick Inc., All rights reserved. --\x3e\x3cscript src\x3d\x22http://s0.2mdn.net/879366/flashwrite_1_2.js\x22\x3e\x3c/script\x3e\n\x3cSCRIPT LANGUAGE\x3d\x22JavaScript\x22\x3e\n\x3c!--\nfunction DCFlash(id,pVM){\nvar swf \x3d \x22http://s0.2mdn.net/877848/CLB012__Hiking_728x90.swf\x22;\nvar gif \x3d \x22http://s0.2mdn.net/877848/Celebrex_728x90_Unbranded_Backup.3.11.13_1.gif\x22;\nvar minV \x3d 8;\nvar FWH \x3d \x27 width\x3d\x22728\x22 height\x3d\x2290\x22 \x27;\nvar url \x3d escape(\x22http://adclick.g.doubleclick.net/aclk?sa\x3dL\x26ai\x3dBkkTr1ABuUYnfKOz56AHh_4HQCbOj0YsDAAAAEAEgADgAUIC6g9b______wFYs4bGy0xgyYb2iISk7A-CARdjYS1wdWItNjc2MDQyMjg4NTEzMDEyMrIBGHd3dy5kY2xrLWRlZmF1bHQtcmVmLmNvbboBCWdmcF9pbWFnZcgBCdoBIGh0dHA6Ly93d3cuZGNsay1kZWZhdWx0LXJlZi5jb20vmAKIpAHAAgLgAgDqAi00Nzg4L2huLnVzLmhtbnloLmRpci54LngueC9DZWxlYnJleF9BcnRocml0aXP4AoHSHpAD4AOYA-ADqAMB4AQ |
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
# Syntax sugar | |
class ArrayValidator < EnumValidator | |
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
package wordle | |
/** Wordle solver, game runner & simulator | |
* | |
* Optimizes based on a combination of an allowed word list (from the Wordle source code or any | |
* other source), word frequency data and the move in the game. | |
* | |
* @note | |
* [[Wordle.Game]] is mutable to allow for play in an environment without easy STDIN input. Use | |
* [[Wordle.Game.nextMove()]]. All words are in lowercase. Patterns are entered as as strings of |
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
-- #t behaves strangely with hashtables & nil values | |
function table_length(t) | |
local count = 0 | |
for _ in pairs(t) do count = count + 1 end | |
return count | |
end | |
function Test(test, expectation) | |
return { | |
test = test, |
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
# Returns the stack of RScript files | |
rscript.stack <- function() { | |
Filter(Negate(is.null), lapply(sys.frames(), function(x) x$ofile)) | |
} | |
# Returns the current RScript file path | |
rscript.current <- function() { | |
stack <- rscript.stack() | |
as.character(stack[length(stack)]) |
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
# Memory snapshot analyzer which parses the /proc file system on *nix | |
# | |
# Example (run in Heroku console): | |
# | |
# ms = MemorySnapshot.new | |
# 1.upto(10000).map { |i| Array.new(i) }; nil | |
# ms.snapshot!; nil | |
# ms.diff 10 | |
# => {"lib/ld-2.11.1.so"=>156, "heap"=>2068, "all"=>2224} | |
# |
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
# RSpec matcher to spec delegations. | |
# Forked from https://gist.github.com/txus/807456 with added bug fixes | |
# | |
# Usage: | |
# | |
# describe Post do | |
# it { should delegate(:name).to(:author).with_prefix } # post.author_name | |
# it { should delegate(:month).to(:created_at) } | |
# it { should delegate(:year).to(:created_at) } | |
# it { should delegate(:something).to(:'@instance_var') } |
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
// This code is designed to be pasted in spark-shell in a *nix environment | |
// On Windows, replace sys.env("HOME") with a directory of your choice | |
import java.io.File | |
import java.io.PrintWriter | |
import org.apache.spark.sql.hive.HiveContext | |
import org.apache.spark.sql.SaveMode | |
import org.apache.spark.sql.SaveMode | |
val ctx = sqlContext.asInstanceOf[HiveContext] |
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 ctx = sqlContext | |
import ctx.implicits._ | |
// With nested structs, sometimes JSON is a much more readable form than display() | |
def showall(df: DataFrame, num: Int): Unit = df.limit(num).toJSON.collect.foreach(println) | |
def showall(sql: String, num: Int = 100): Unit = showall(ctx.sql(sql), num) | |
def hivePath(name: String) = s"/user/hive/warehouse/$name" | |
// Bug workaround |
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.apache.spark.sql.hive.HiveContext | |
val ctx = sqlContext.asInstanceOf[HiveContext] | |
import ctx.implicits._ | |
// Table test is not present | |
ctx.tableNames | |
// ERROR Hive: NoSuchObjectException(message:default.test table not found) | |
ctx.sql("drop table if exists test") |
NewerOlder