Skip to content

Instantly share code, notes, and snippets.

View zolrath's full-sized avatar

Matt Furden zolrath

View GitHub Profile
@zolrath
zolrath / WE-Markdown.css
Created January 20, 2016 09:23 — forked from jerone/WE-Markdown.css
Github Flavored Markdown Stylesheet for Web Essentials
html {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
font-family: sans-serif;
}
body {
margin: 0;
padding: 30px;
min-width: 1020px;
@zolrath
zolrath / OpenSimplexNoise.cs
Created January 19, 2016 20:10 — forked from digitalshadow/OpenSimplexNoise.cs
OpenSimplex Noise Refactored for C#
/* OpenSimplex Noise in C#
* Ported from https://gist.github.com/KdotJPG/b1270127455a94ac5d19
* and heavily refactored to improve performance. */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
namespace NoiseTest
@zolrath
zolrath / TimeOfDayManager
Created January 19, 2016 00:30 — forked from anonymous/TimeOfDayManager
Control the sun, fog, ambient light, and sun rotation through curves and gradients.
using UnityEngine;
public class TimeOfDayManager : MonoBehaviour
{
public float secondsInFullDay = 120f;
[HideInInspector]
public float timeMultiplier = 1f;
@zolrath
zolrath / gist:20632edb82bdb5322652
Created June 10, 2014 00:15
Partial application of struct method is not allowed
// Changing struct to class works swimmingly.
struct Test {
func returnTwo() -> Int {
return 2
}
func returnFive() -> Int {
let twofunc = returnTwo // Partial application of struct method is not allowed
return twofunc() + 3
}
@zolrath
zolrath / gist:2516236
Created April 28, 2012 05:15
More Idiomatic Code Example
# Current Example:
(1..albums.length).each do |i|
eb.send(pa, {
'action' => 'save',
'collection' => 'albums',
'document' => albums[i - 1]
})
end
@zolrath
zolrath / gist:2409649
Created April 17, 2012 22:51
Changelog Generation Methods
" Takes less than a second.
func! s:create_changelog() abort
for bundle in g:updated_bundles
let updates = system('cd '.shellescape(bundle.path()).
\ ' && git log --pretty=format:"%s %an, %ar" --graph'.
\ ' vundle_update..HEAD')
call add(g:vundle_changelog, '')
call add(g:vundle_changelog, 'Updated Bundle: '.bundle.name)
@zolrath
zolrath / gist:2305333
Created April 4, 2012 20:27
tmux status line from wemux example.

For a tmux status line as seen in the example image for the wemux project: wemux

The session on the left in the example screen shot uses a patched font from the vim-powerline project. Inconsolata-dz, you beautiful creature.

To duplicate the left status line add the following lines to your ~/tmux.conf

set -g status-left-length 32
set -g status-right-length 150
require 'nokogiri'
PERSON = "Andrew Marrone"
def extract_messages_of(name)
messages = []
face = Nokogiri::XML(File.open("messages.html"))
face.css("div.msgbody").each do |n|
if n.parent.css('span').text == name
messages << n.text.strip + "."
end
end
;; As it turns out, A is much slower than B in some cases, but faster in others! Fun.
(time (sum-divisorsA 2000000)) => "Elapsed time: 3766.863 msecs"
(time (sum-divisorsB 2000000)) => "Elapsed time: 113.786 msecs"
(time (sum-divisorsA 200000)) => "Elapsed time: 3.233 msecs"
(time (sum-divisorsB 200000)) => "Elapsed time: 8.436 msecs"
@zolrath
zolrath / gist:1177848
Created August 29, 2011 05:56
Clojure 1.2.1 vs 1.3.0-beta2 Question
;; This takes about 1.7 seconds in Clojure 1.2.1 and takes 10 times as long in 1.3.0-beta2
;; Also, I'm learning Clojure so ignore the generally horrible code.
;; Tried switching to lazy-seqs prime to see if that narrowed the gap. It's a bit slower, but the gap is still there!
;; Clojure 1.2.1
(time (solve21))
"Elapsed time: 2333.739 msecs"
31626
;; Clojure 1.3.0-beta2
(time (solve21))