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
// reference: https://gist.github.com/bufferine/1330475 | |
import net.liftweb.json.Xml // converts XML to JSON | |
import com.mongodb.casbah.Imports._ // To put stuff in Mongo | |
import com.mongodb.casbah.MongoDB // To connect to Mongo | |
import com.mongodb.util.JSON // To parse JSON into a MongoDBObject | |
import net.liftweb.json._ // To output Lift JSON as actual JSON | |
import scala.xml.XML // To load XML | |
// load the XML | |
val xml = XML.load("http://www.w3schools.com/xml/note.xml") |
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> | |
<style> | |
#placeholderJavaScript * { | |
border: 1px solid green; | |
} | |
#placeholderjQuery * { | |
border: 1px solid blue; |
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 requestDocument() { | |
var fileInput = $("select[name=requirements]").val() | |
if (fileInput.length == 0 || fileInput == "Select a document...") { | |
alert("Please select a file"); | |
return; | |
} | |
var xhr = new XMLHttpRequest(); |
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
func uploadHandler(w http.ResponseWriter, r *http.Request) { | |
body, err := ioutil.ReadAll(r.Body) | |
if err != nil { | |
fmt.Println("bad request sent") | |
w.WriteHeader(400) | |
return | |
} | |
filename := string(body) |
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 python | |
import argparse | |
import sys | |
def tokenize(source): | |
return list(source) | |
def parse(tokens): |
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 matplotlib.pyplot as plt | |
unit_test = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] | |
area = [] | |
threads_num_max = 10 | |
for i in range(0,len(unit_test)): | |
area.append([]) | |
for thread_num in range(1,threads_num_max+1): | |
area[i].append((thread_num, unit_test[i] * thread_num)) |
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
// Playbook: http://play.golang.org/p/kp5uL_mMGk | |
// Note: Type assertion like "someVariable.(string)" is useful when you are dealing with interface{} (empty interface) | |
package main | |
import ( | |
"fmt" | |
"strconv" | |
) |
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 sys | |
sys.path.insert(0,"../..") | |
import readline | |
import os | |
import ply.lex as lex | |
import ply.yacc as yacc | |
import numpy |
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 main | |
import ( | |
"fmt" | |
"io" | |
"os" | |
"strconv" | |
) | |
type Graph struct { |
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 main | |
import "fmt" | |
import "sort" | |
type Dict map[int64]float64 | |
// A slice of Pairs that implements sort.Interface to sort by Key. | |
type PairList []Pair |