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 "regexp" | |
func CleanQuery(q string) string { | |
r1 := regexp.MustCompile(`\s+`) | |
r2 := regexp.MustCompile(`--[^\n]*\n`) | |
q = r2.ReplaceAllString(q, "") | |
return r1.ReplaceAllString(q, " ") | |
} |
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
// heavily borrowed from Rosetta Code example | |
package main | |
import "fmt" | |
type row map[string]interface{} | |
var ( | |
tableA = []row{ | |
row{"name": "Jonah", "age": 27}, |
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
// heavily borrowed from Rosetta Code example | |
package main | |
import ( | |
"fmt" | |
) | |
type row map[string]interface{} | |
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
# coding: utf-8 | |
# In[70]: | |
import re | |
ssn_data = [ | |
["000115464","000135464"], # 4 | |
["763415464", "165415464"], #6 |
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
local MAX_ACCOUNT_ID = 1 | |
function withdraw(self, v) | |
self.balance = self.balance - v | |
end | |
function deposit (self, v) | |
self.balance = self.balance + v | |
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
CSV = {} | |
function CSV:load (filename, headers) | |
headers = headers or false | |
-- if not headers then | |
file = io.open(filename, "r") -- "test.csv" | |
linecount = 0 | |
panel = {} | |
setmetatable(panel, self) |
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
from __future__ import division | |
import math | |
def future_value(V, R, n, m=1): | |
return V * (1+(R/m))**(n*m) | |
def present_value(FV, R, n): | |
return FV / ((1+R)**n) |
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
0000000 000 0000000 | |
111111111 11111111100 000 111111111 | |
00000 111111111111111111 00000 000000 | |
000 1111111111111111111111111100000 000 | |
000 1111 1111111111111111100 000 | |
000 11 0 1111111100 000 | |
000 1 00 1 000 | |
000 00 00 1 000 | |
000 000 00000 1 000 | |
00000 0000 00000000 1 00000 |
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 ( | |
"container/ring" | |
"fmt" | |
"os" | |
"time" | |
) | |
func main() { |
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" | |
func main() { | |
a := A{} | |
a.N = "hello" | |
fmt.Println(a.Method.O("world")) | |
fmt.Println(a.Method.I("whatup!")) | |
fmt.Println(a.Method.F("wtf?")) |