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
diff --git a/package.json b/package.json | |
index faa6f57..545b39d 100644 | |
--- a/package.json | |
+++ b/package.json | |
@@ -3,12 +3,16 @@ | |
"version": "0.0.1", | |
"private": true, | |
"dependencies": { | |
- "express": "2.3.12", | |
+ "express": "*", |
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
class Entity: | |
def __init__(self, data): | |
self.data = data | |
class Org(Entity): | |
@property | |
def avatar_url(self): | |
return self.data["avatar_url"] |
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
class Entity: | |
def __init__(self, jsonData) | |
self.jsonData = jsonData | |
@classmethod | |
def register_fields(cls, *fields): | |
for name in fields: | |
setattr(cls, name, property(lambda cls: cls.jsonData[name])) | |
class Org(Entity): |
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
@if (this.Model.Users.Count > 0) | |
{ | |
@this.Model.Users.Count(a => a.IsAdmin) of @this.Model.Users.Count are admins | |
} |
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
public class CountItem<T> | |
{ | |
public int Count { get; set; } | |
public T Value { get; set; } | |
} | |
var states = new List<string> | |
{ | |
"WA", |
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
for (f in dbPerson.family) do | |
// try and find the fm in the api | |
foundFm = null | |
for (apiFm in apiPerson.family) do | |
if apiFm == f then | |
foundFm = apiFm | |
break | |
end | |
end | |
if foundFm != null then |
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
public enum CallType { | |
Outgoing("Outgoing Call"), | |
Incoming("Incoming Call"), | |
Missed("Missed Call"); | |
private String label; | |
public String getLabel() { | |
return this.label; | |
} |
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
// assumes you have already gotten this json back from an Http server: | |
// [{"id":1,"firstName":"j","lastName":"v"},{"id":2,"firstName":"Dr. a","lastName":"b"}] | |
// and stored it in a String called json | |
JSONArray json = new JSONArray(json); | |
// loop over each individual json object: | |
// a single json object looks like: {"id":1,"firstName":"j","lastName":"v"} | |
int count = json.length(); | |
for (int i = 0; i < count; 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
private struct Row | |
{ | |
public int UserId; | |
public DateTime DateUtc; | |
} | |
List<Row> table = new List<Row> | |
{ | |
new Row { UserId = 1, DateUtc = DateTime.Parse("2012-01-05 17:00:00.000") }, | |
new Row { UserId = 1, DateUtc = DateTime.Parse("2012-01-26 17:00:00.000") } |
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
;WITH base AS | |
( | |
SELECT UserId, | |
DateUtc, | |
ROW_NUMBER() over (partition BY UserId ORDER BY DateUtc) AS rn | |
FROM dbo.UserActivity WHERE DateUtc Between @startDate and @endDate | |
) | |
SELECT b1.UserId, | |
SUM(CASE |