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
using System; | |
using System.Threading.Tasks; | |
namespace Life | |
{ | |
public class LifeSimulation | |
{ | |
private bool[,] world; | |
private bool[,] nextGeneration; | |
private Task processTask; |
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
MongoServer server = MongoServer.Create("mongodb://TheUserName:ThePassword@The.Url.Com:12345/TheDatabaseId"); | |
MongoDatabase mongo = server.GetDatabase("<TheDatabaseId>"); | |
var employees = mongo.GetCollection<TheClass>("TheCollectionName"); | |
var cursor = employees.FindAllAs<TheClass>(); | |
var item = cursor.FirstOrDefault(); | |
.... |
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
var engine = new JintEngine(); | |
engine.SetFunction("alert", new Action<string>(t => MessageBox.Show(t))); | |
engine.Run("alert('Hello World, from dynamically interpereted JavaScript on WP7!')"); |
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 com.your.project; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.lang.ref.SoftReference; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
import java.net.URLConnection; | |
import java.util.Collections; | |
import java.util.HashMap; |
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
/** pieced together from http://www.androidsnippets.com/create-a-md5-hash-and-dump-as-a-hex-string */ | |
public String md5(String s) { | |
try { | |
// Create MD5 Hash | |
MessageDigest digest = java.security.MessageDigest.getInstance("MD5"); | |
digest.update(s.getBytes()); | |
byte messageDigest[] = digest.digest(); | |
// Create Hex String | |
StringBuffer hexString = new StringBuffer(); |
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 cyborg; | |
import java.io.IOException; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import org.xmlpull.v1.XmlPullParser; | |
import org.xmlpull.v1.XmlPullParserException; | |
import android.content.Context; |
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
using System; | |
using System.Dynamic; | |
using MonoMac.Foundation; | |
namespace CodeCube | |
{ | |
public class UserSettings : DynamicObject | |
{ | |
NSUserDefaults defaults = NSUserDefaults.StandardUserDefaults; |
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
// http://stackoverflow.com/a/4007066/5416 | |
@implementation NSObject (PerformBlockAfterDelay) | |
- (void)performBlock:(void (^)(void))block | |
afterDelay:(NSTimeInterval)delay | |
{ | |
block = [[block copy] autorelease]; | |
[self performSelector:@selector(fireBlockAfterDelay:) | |
withObject:block |
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
using System; | |
using System.Linq; | |
using System.Collections.Generic; | |
namespace Permutations | |
{ | |
class MainClass | |
{ | |
public static void Main (string[] args) | |
{ |
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
static class x10 { | |
public static IEnumerable<T> Iter<T>(this IEnumerable<T> list, Action<T> action) { | |
foreach (var n in list) { | |
action (n); | |
yield return n; | |
} | |
} | |
} |
OlderNewer