Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>Furtive Bear</title>
<style>
body { margin: 0; }
canvas { width: 100%; height: 100% }
</style>
</head>
@lifebeyondfife
lifebeyondfife / declarative programming repo solution.cs
Created December 1, 2016 13:29
Declarative Programming Repo Solution. Solution available in C#, JavaScript and Python.
/*
Code below can be run directly into LINQPad - https://www.linqpad.net/
Return the owner and repo name of the most starred project with more than 100 contributors, for each language
The declarative implementation can be solved using the Select, Where, Aggregate and GroupBy LINQ extension methods
*/
void Main()
{
var repos = new List<Repo> {
@lifebeyondfife
lifebeyondfife / declarative programming repo problem.cs
Last active April 25, 2017 11:10
Declarative Programming Repo Problem. Problem available in C#, JavaScript and Python.
/*
Code below can be run directly into LINQPad - https://www.linqpad.net/
Return the owner and repo name of the most starred project with more than 100 contributors, for each language
The declarative implementation can be solved using the Select, Where, Aggregate and GroupBy LINQ extension methods
*/
void Main()
{
var repos = new List<Repo> {
@lifebeyondfife
lifebeyondfife / ImperativeFunctional.cs
Created February 28, 2016 12:02
Imperative and Functional coding in C#
using System;
using System.Collections.Generic;
using System.Linq;
namespace HigherOrderFunctions
{
enum Tech
{
Red,
Green,
@lifebeyondfife
lifebeyondfife / imperative_functional.py
Created February 28, 2016 12:01
Imperative and Functional coding in Python
from itertools import groupby
from operator import itemgetter
name, age, tech, skill = range(0, 4)
data = [
['alice', 24, 'blue', 86],
['alice', 24, 'green', 80],
['bob', 20, 'red', 76],
['bob', 20, 'green', 68],
AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
{
String resourceName = Assembly.GetExecutingAssembly().GetName().Name + "." + new AssemblyName(args.Name).Name + ".dll";
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
{
Byte[] assemblyData = new Byte[stream.Length];
stream.Read(assemblyData, 0, assemblyData.Length);
return Assembly.Load(assemblyData);
@lifebeyondfife
lifebeyondfife / gist:f73674e4a86a853e5db6
Created October 21, 2014 12:20
Solving https://news.ycombinator.com/item?id=8486278 with the Decider constraint solver tool
using Decider.Csp.BaseTypes;
using Decider.Csp.Integer;
using System;
using System.Collections.Generic;
namespace Chickens
{
class Program
{
static void Main(string[] args)