This file contains hidden or 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
/** | |
* Checks all fields of an object literal for values. | |
* @param {Object} object - A POJO. | |
* @param {Array<String>} omitProperies - An array of properties that you wish to omit from the checker e.g. "id". | |
* @returns {Boolean} | |
*/ | |
function isObjectDirty(object, omitProperties) { | |
if(omitProperties) { | |
object = _.omit(object, omitProperties); | |
} |
This file contains hidden or 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
<input | |
value={this.props.complexForm.firstName} | |
onChange={this.onPropertyChanged} | |
/> |
This file contains hidden or 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
let calculateRatio x = x * goldenRatio | |
let getValue (index: int32) = | |
Console.WriteLine("Enter value " + index.ToString()); | |
Console.ReadLine() | |
let getValues count = | |
let result = | |
[ for i in 1 .. count -> float(getValue(i))] | |
result |
This file contains hidden or 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
open System | |
let getUserInput message predicate = | |
let mutable loop = true | |
let mutable userInput = ""; | |
while loop do | |
printf "%s" message; | |
userInput <- Console.ReadLine(); | |
let isValid = predicate(userInput) | |
if isValid = true then loop <- false |
This file contains hidden or 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
packages: [ | |
"atom-beautify" | |
"emmet" | |
"git-blame" | |
"git-plus" | |
"highlight-selected" | |
"language-babel" | |
"linter" | |
"linter-eslint" | |
"monokai-seti" |
This file contains hidden or 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
#r "/Users/craig/Projects/gitsharp/LibGit2Sharp.0.21.0.176/lib/net40/LibGit2Sharp.dll" | |
open LibGit2Sharp | |
//plonk the native dll here | |
System.Environment.CurrentDirectory <- __SOURCE_DIRECTORY__ | |
let printer (c: Commit) = | |
sprintf "User %s" c.Author.Email |> ignore | |
let filter = new CommitFilter(); | |
filter.Since <- "Tag1"; |
This file contains hidden or 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
@Test | |
public void test() { | |
running(testServer(3333, fakeApplication(inMemoryDatabase())), org.openqa.selenium.phantomjs.PhantomJSDriver.class, new Callback<TestBrowser>() { | |
public void invoke(TestBrowser browser) { | |
browser.goTo("http://www.google.com"); | |
//test presence of stuff. | |
browser.takeScreenShot("/tmp/screenshot.jpg");//could be stored in a doco db | |
} | |
}); | |
} |
This file contains hidden or 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
@implementation taskHelper { | |
} | |
+ (void)runTaskInBackground:(void (^)())backgroundTask | |
{ | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), backgroundTask); | |
} | |
+ (void)runTaskInForeground:(void (^)())foregroundTask |
This file contains hidden or 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
/* | |
Call the api client like this: | |
var client = new ApiClient<SEnvelope>("https://baseurl.com/api/v1"); | |
//you would overload and add an auth_token param here | |
client.GetDtoAsync("envelopes", "object_id", (response) => //callback | |
{ | |
this.SEnvelope = response.Data;//should be an envelope from the server | |
}); | |
This file contains hidden or 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 createNamespace(fromString){ | |
var split = fromString.split('.'); | |
var parent = window; | |
var current = ''; | |
var length = split.length; | |
for(var i = 0; i < length; i++){ | |
current = split[i]; | |
parent[current] = parent[current] || {}; | |
parent = parent[current]; |
NewerOlder