Skip to content

Instantly share code, notes, and snippets.

Jorge Chavez jorgechavz

Block or report user

Report or block jorgechavz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jorgechavz
jorgechavz / gist:1015467773de5e008bbf
Created Jun 19, 2015
Scrolling to HTML element
View gist:1015467773de5e008bbf
<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"),
View Swift: Convert structs and enums to NSData and vice-versa
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)
You can’t perform that action at this time.