Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block darsen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
darsen / TestController.cs
Created Mar 25, 2016
Send complex objects to .Net Web Api through URL using FromUri attribute
View TestController.cs
namespace FromUri.Controllers
using System;
using System.Web.Http;
/// <summary>
/// Url sample call:
/// http://localhost:50872/api/test?
/// </summary>
View AsyncTest.swift
import XCTest
class AsyncTests: XCTestCase {
func testExample() {
//set expectaton
let expectation = expectationWithDescription("Swift Expectations")
let url = NSURL(string: "")
let request = NSURLRequest(URL: url!)
NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue()) {
darsen / CustomTextField.swift
Created Aug 6, 2015
Custom TextField in swift
View CustomTextField.swift
import Foundation
import UIKit
class CustomTextField: UITextField, UITextFieldDelegate{
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.delegate = self
darsen /
Created Jul 13, 2015
Sample Java Code Koan
public void localTime () {
LocalTime t1 = LocalTime.of(7,30);
assertEquals(t1, LocalTime.parse(__));
darsen /
Last active Dec 16, 2017
Java Simple Lambda Koan
interface Caps {
public String capitalize(String name);
public void simpleLambda() {
Caps caps = (String n) -> {
return n.toUpperCase();
String capitalized = caps.capitalize("James");
darsen / Money.js
Last active Dec 17, 2015
Using Jasmine and custom matchers to check object equality.
View Money.js
function Money(amount, currency){
this.amount = amount;
this.currency = currency;
this.sum = function (money){
return new Money(200, "CLP");
darsen /
Last active Dec 14, 2015
Parameterized tests in JUnit Parameterized tests in JUnit can be very useful when writing tests based on tabular data. These type of tests can save you from writing a lot of duplicate or boilerplate code. While there is a fair amount of articles on the subject on the Internet, I wasn’t able to find a code sample that you can simply copy into you…
package com.empoweragile;
import static org.junit.Assert.assertEquals;
import java.util.Arrays;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
You can’t perform that action at this time.