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 'rubygems' | |
require 'rsolr' | |
require 'rsolr-ext' | |
solr = RSolr::Ext.connect :url => 'http://localhost:8983/solr' | |
#add | |
docs = [ | |
{:id => 1, :words_txt => 'blue green red', :type_s => 'book'}, | |
{:id => 2, :words_txt => 'war of worlds blue', :type_s => 'book'}, |
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/sh | |
# get documents older than 90 days | |
curl 'http://localhost:8983/solr/select?q=date_tdt:%5B*%20TO%20NOW-90DAYS%5D' |
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
[Definition] | |
failregex = <HOST> - - \[.*\] \"(GET|POST).*(phpMyAdmin|phpmyadmin|dbadmin|mysql|myadmin|w00t|mysqladmin).* 404 | |
ignoreregex = |
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
failregex = ^<HOST> -.*/(phpMyAdmin|phpmyadmin).*$ | |
^<HOST> -.*CONNECT.*$ |
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
<html> | |
<head> | |
<script type="text/javascript" src="jquery-1.7.1.min.js"></script> | |
<script type="text/javascript" src="underscore-min.js"></script> | |
<script> | |
$(document).ready(function() { | |
var people_records = {people:[{first_name:'joe', last_name:'shmo'}, {first_name:'jane', last_name:'smith'}]}; | |
var row_template = "<% _.each(people, function(obj) { %> <tr> <td> <%= obj.first_name %> </td> <td> <%= obj.last_name %> </td> </tr> <% }); %>"; | |
$("#table_rows").html( _.template( row_template, people_records ) ); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>QUnit Tests</title> | |
<link rel="stylesheet" href="qunit.css"> | |
</head> | |
<body> | |
<h1 id="qunit-header">QUnit Hello World</h1> | |
<h2 id="qunit-banner"></h2> |
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
var App = { | |
something: function(args1, callback) { | |
console.log("in something 2"); | |
callback.apply(App, arguments); | |
return false; | |
}, | |
dothis: function() { | |
var l = ['one','two']; | |
var s = "hi"; | |
App.something(s, function(args1) { |
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
/* | |
The key is to map unique roman numerals to binary values, then start from traversing through the list from high values to low values. | |
When binary is greater, start building the roman string, subtracting from the binary as you go. | |
Takeaway: If writing a conversion problem, make list mapping one to another. Also, look for "shortcuts" or patterns to avoid full lists mapping each value. | |
*/ | |
def binaryToRoman(int binary) { | |
def RCODE = ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"] |
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 'rubygems' | |
require 'mongo' | |
@conn = Mongo::Connection.new | |
@db = @conn['geo-db'] | |
@coll = @db['places'] | |
File.open("US.txt", "r").each do | line | | |
sp = line.split("\t") | |
#country zip state region lat long |
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
function randomOne(from, to) { | |
return Math.floor(Math.random() * (to - from + 1) + from); | |
} | |
var name = ['tom', 'jeff', 'carol', 'mike', 'robert', 'suzan', 'wendy'] | |
var st = ['va', 'md', 'ny', 'ca', 'fl', 'oh', 'mi']; | |
var food = ['pizza', 'hamburger', 'spaghetti', 'burrito', 'seafood', 'indian', 'thai'] | |
var quote = ['abc abc abc abc....', 'cba cba cba cba....', 'xyz xyz xyz...', | |
'jio jio jio....', 'oww oww oww...', 'fow fow fow...', 'soi soi soi...'] |