This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func encode<T>(var value: T) -> NSData { | |
return withUnsafePointer(&value) { p in | |
NSData(bytes: p, length: sizeofValue(value)) | |
} | |
} | |
func decode<T>(data: NSData) -> T { | |
let pointer = UnsafeMutablePointer<T>.alloc(sizeof(T.Type)) | |
data.getBytes(pointer) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="#" data-go="#node-element" class="go">Go to</a> | |
<script type="text/javascript"> | |
$(".go").click(function(e){ | |
//We prevent the default scroll | |
e.preventDefault(); | |
var $this = $(this), | |
to = $this.attr("data-go"), |