Skip to content

Instantly share code, notes, and snippets.

View nrkn's full-sized avatar

Nik nrkn

View GitHub Profile
@nrkn
nrkn / iframe-rawgit.html
Last active August 29, 2015 14:19
Foundation Media Query Preview
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Foundation Media Query Preview</title>
<style>
* {
margin: 0;
padding: 0;
@nrkn
nrkn / h5on-lite.css
Last active August 29, 2015 14:22
H5ON lite
js-object, js-array, js-string, js-number, js-boolean, js-null {
display: inline-block;
}
js-object > *, js-array > * {
display: table-row;
}
js-object > *:before, js-array > *:before {
display: table-cell;
@nrkn
nrkn / iframe.html
Created July 14, 2015 23:57
Medium.js invoke in iframe
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>iframe</title>
<style>
#edit {
outline: 1px solid #ccc;
min-height: 1em;
}
@nrkn
nrkn / saveload.cs
Created March 8, 2011 22:51
Save/load arbitrary .NET objects
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
namespace LosvRLLib {
/// <summary>
/// Usage:
/// <![CDATA[
/// var mapPersistence = new Persistence<Map>();
/// var map = mapPersistence.Load( "map.dat" );
///
@nrkn
nrkn / gist:2165487
Created March 22, 2012 23:33
My eyes the googles do nothing
Console.Write(
Enumerable
.Range( 0, 7 )
.Where( bit => bit % 2 == 0 )
.Aggregate(
String.Empty,
( result, bit ) => result + ( bit / 2 < 2 ? "apples" : "oranges" )
)
);
@nrkn
nrkn / gist:2165741
Created March 23, 2012 00:19
C# get valid chars
var validChars = (
Enumerable
.Range( '0', 10 )
.Concat( Enumerable.Range( 'A', 26 ) )
.Concat( Enumerable.Range( 'a', 26 ) )
.Select( i => (char) i )
);
@nrkn
nrkn / FileSystemToTree.cs
Last active December 17, 2015 22:49
Make a path into a collapsible tree
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace FileSystemToTree
{
class Program
{
static void Main(string[] args)
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/index.js",
"stopOnEntry": false,
"args": [],
@nrkn
nrkn / adapter.ts
Last active October 17, 2016 02:12
interface Predicate<T> {
( subject:T ): boolean
}
interface DomAdapter<TNode, TElementNode> {
// is the node a tag?
isTag: Predicate<TNode>,
// does at least one of passed nodes pass the test?
existsOne: ( test:Predicate<TElementNode>, nodes:[TNode] ) => boolean,
const template = data =>
`<p>
Use the <strong>${ data.power }</strong>, ${ data.name }!
</p>`
document.getElementById( 'target' ).innerHTML = template( {name: "Luke", power: "force"} )