Skip to content

Instantly share code, notes, and snippets.

@jaycobbcruz
jaycobbcruz / Permutations.java
Last active February 16, 2022 09:20
Find all permutations of given items using Java 8
public class Permutations {
public static <T> Stream<Stream<T>> of(final List<T> items) {
return IntStream.range(0, factorial(items.size())).mapToObj(i -> permutation(i, items).stream());
}
private static int factorial(final int num) {
return IntStream.rangeClosed(2, num).reduce(1, (x, y) -> x * y);
}
@mikebluestein
mikebluestein / HelloSceneKitController.cs
Last active November 18, 2022 20:57
A simple iOS 8 Scene Kit example using C# and Xamarin
using System;
using MonoTouch.UIKit;
using MonoTouch.SceneKit;
using MonoTouch.Foundation;
namespace HelloSceneKit
{
public class HelloSceneKitController : UIViewController
{
SCNView sceneView;
@zaus
zaus / jquery.tinierpubsub.js
Last active December 12, 2015 10:08 — forked from cowboy/HEY-YOU.md
/* jQuery Tinier Pub/Sub - v0.9 - 2013-02-11
* original by http://benalman.com/ 10/27/2011
* Original Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function($) {
// "topic" holder
var o = $({}); // use $('<b>') with Zepto, as it doesn't like {} ?
// attach each alias method