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 partial class CountryShardedDatabase | |
{ | |
public static CountryShardedDatabase FromCountry(string country) | |
{ | |
var db = new CountryShardedDatabase(string.Format("name={0}", ConfigurationManager.ConnectionStrings[country].Name)); | |
db.Country = country; | |
db.ObjectMaterialized += new System.Data.Objects.ObjectMaterializedEventHandler(db_ObjectMaterialized); | |
return db; |
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
JavaScript: | |
var data = [] | |
for (var i = 0; i < 84; i++) { | |
data.push(i * 10 / 84); | |
} | |
CoffeeScript: | |
data = (i * 10 / 84 for i in [0..83]) |
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
width = 760 | |
height = 260 | |
xmin = -1.2 | |
xmax = 5 | |
x_scale = d3.scale.linear() | |
x_scale.domain([xmin, xmax]) | |
.range [0, width] |
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 User GetUserByEmail(string email) | |
{ | |
var key = email; | |
var user = Cache.Cache.Get<User>(key); | |
if (user == null) | |
{ | |
try | |
{ | |
user = builder.BuildFromNewDbs(email); |
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 User GetUserByEmail(string email) | |
{ | |
/* | |
* I use the email param as a key to get a user from cache, | |
* so I store the email in a variable called "key". | |
* If the user is in cache, we're done! If the user isn't in cache, | |
* I try to get it from the new database. | |
* If the user isn't in the new database, everything may blow up, | |
* so I have to be careful just in case it does. | |
* There's no way for me to know whether the user |
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 User GetUserByEmail(string email) | |
{ | |
/* | |
* I use the email param as a key to get a user from cache, | |
* so I store the email in a variable called "key". | |
* If the user is in cache, we're done! If the user isn't in cache, | |
* I try to get it from the new database. | |
* If the user isn't in the new database, everything may blow up, | |
* so I have to be careful just in case it does. | |
* There's no way for me to know whether the user |
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 User GetUserByEmail(string email) | |
{ | |
/* | |
* You give me an email and I'll give you a user. | |
* By the way, I'll make use of a cache layer so that | |
* your request doesn't result in performance issues. | |
* It's not a wonderful world (sorry, Louis Armstrong), | |
* so in case something goes wrong I'll just write it down | |
* for someone to take a look at it later. | |
*/ |
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
@columns = [] | |
ConditionCodeProperty.select('property, format, field_name').select('GROUP_CONCAT(condition_code) as conditions').group('property, format, field_name').where(condition_code: current_user.condition_codes).each do |condition_code_property| | |
unless Result.is_common(condition_code_property.property) | |
common = Result.is_extended_common(condition_code_property.property) | |
column = { | |
property_name: condition_code_property.property, | |
value_accessor: condition_code_property.property, | |
human_name: Result.human_name_for(condition_code_property.property), | |
field_name: condition_code_property.field_name, | |
extended: !common, |
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
-module(test). | |
-export([get_layers/2]). | |
auth_header(User, Pass) -> | |
Encoded = base64:encode_to_string(lists:append([User, ":", Pass])), | |
{"Authorization", "Basic " ++ Encoded}. | |
get_layers(User, Pass) -> | |
Headers = [auth_header(User, Pass)], | |
httpc:request(get, {"http://facilities.moh.gov.rw/collections/26/layers.json", Headers}, [], []). |
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 AllReportsByTimestampDesc extends UnicefGisView { | |
... | |
... | |
... | |
public List<Map<String, Object>> query() { | |
view.updateIndex(); | |
CBLQueryOptions options = new CBLQueryOptions(); | |
options.setDescending(true); |
OlderNewer