Skip to content

Instantly share code, notes, and snippets.

View dend's full-sized avatar
🚧
Building Things

Den Delimarsky dend

🚧
Building Things
View GitHub Profile
@dend
dend / gist:4553993
Created January 17, 2013 05:51
Prism implementation of RemoveAll (Feb2012 release)
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists")]
public static void RemoveAll<T>(this List<T> list, Func<T, bool> filter)
{
if (list == null) throw new ArgumentNullException("list");
if (filter == null) throw new ArgumentNullException("filter");
for (int i = 0; i < list.Count; i++)
{
if (filter(list[i]))
{
list.Remove(list[i]);
@dend
dend / gist:4554128
Created January 17, 2013 06:25
Proper implementation for RemoveAll<T>
public static void RemoveAll<T>(this List<T> list, Func<T, bool> filter)
{
if (filter == null)
throw new ArgumentException("filter");
if (list == null)
throw new ArgumentException("list");
int index = 0;
while ((index < list.Count) && !filter(list[index]))
using System;
namespace HEXtoARGB
{
class Program
{
static void Main(string[] args)
{
// Original ActionScript snippet from this question:
// http://stackoverflow.com/questions/2369746/actionscript-3-0-translating-hex-to-argb

What is Azure Mobile Services?

AzureMobileServices

A highly-scalable cloud infrastructure for your mobile and client applications that allows you to store structured data in the cloud, as well as control how that data is accessed and transferred across devices. In addition to the above, Azure Mobile Services offer the ability to tightly integrate push notifications with connected apps.

Getting started

You can create your mobile app here. In addition to this, there is a very good tutorial that will guide you step-by-step through the process, available here.

Offline Data Sync

$source = "https://www.python.org/ftp/python/3.4.3/python-3.4.3.amd64.msi"
$destination = "c:\Python34\python-3.4.3.amd64.msi"
Write-Host "Downloading Python..."
mkdir C:\Python34
Invoke-WebRequest $source -OutFile $destination
Write-Host "Download complete. Installing Python..."
msiexec /i c:\Python34\python-3.4.3.amd64.msi TARGETDIR=C:\Python34 /qn | Out-Null
Write-Host "Installation complete."
$env:Path += ";C:\Python34;C:\Python34\Scripts"
// Check if we have a push event in place. That is a standard commit.
if (req.headers["x-github-event"] && req.headers["x-github-event"].toLowerCase() === "push")
{
console.log("This is a push event for commit: " + bodyObject.after);
bot.getCommit(bodyObject.after, function(result){
console.log("Commit obtained!");
for(var i = 0; i < result.files.length; i++){
var file = result.files[i];
// Let's read the file contents.
bot.getContent(file.filename, function(result){
var rawContent = result.content;
var decodedContent = Buffer.from(rawContent, 'base64').toString('utf-8');
var parsedContent = yfm.loadFront(decodedContent);
var title = parsedContent.title;
var isSpec = parsedContent.keywords.toLowerCase().indexOf("spec",0) === 0;
if (title && isSpec){
console.log("We have a spec!");
bot.createIssue(title,file.filename,function(result){
title keywords
Bananas! We have content.
Spec, test, testing

Here is some test content.

public class Program
{
static void Main(string[] args)
{
Task.Run(async () => { await ExecuteRunner(); }).GetAwaiter().GetResult();
}
public static async Task<bool> ExecuteRunner()
{
for (int i = 0; i < 583; i++)
// This code example demonstrates the Console.WriteLine() method.
// Formatting for this example uses the "en-US" culture.
using System;
class Sample
{
enum Color {Yellow = 1, Blue, Green};
static DateTime thisDate = DateTime.Now;
public static void Main()