Skip to content

Instantly share code, notes, and snippets.

View btipling's full-sized avatar
:shipit:
shipping code

btipling

:shipit:
shipping code
  • ConductorOne
  • Bay Area, California
  • 17:15 (UTC -12:00)
View GitHub Profile
@buroz
buroz / main.go
Last active April 2, 2024 09:33
Golang SOAP Request Example
package main
import (
"bytes"
"crypto/tls"
"encoding/xml"
"fmt"
"io/ioutil"
"net/http"
"strings"
@btipling
btipling / alignbuffer.swift
Last active October 10, 2019 23:21
Keep your MTLBuffer struct buffer size aligned with this easy to use function
/*
* `bufferSize` is the total size of your buffer when adding up the sizes of your struct's properties (not alignments)
* `alignment` is the largest alignment for your struct. That is one of your struct's properties will have the largest
* alignment value out of all the alignment values for each of your structs properties. Use that value for the second
* argument.
*
* To see the alignment of types see here: https://developer.apple.com/library/ios/documentation/Metal/Reference/MetalShadingLanguageGuide/data-types/data-types.html#//apple_ref/doc/uid/TP40014364-CH2-SW15
*
* Example:
@btipling
btipling / libPNGOpenGL.cpp
Created May 3, 2016 04:19 — forked from mortennobel/ libPNGOpenGL.cpp
Updated to libpng 1.5.15
#ifdef _WIN32
#include <GL/glut.h>
#else
#include <GLUT/glut.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <png.h>
#include <iostream>
@paulirish
paulirish / what-forces-layout.md
Last active May 19, 2024 03:45
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@ggreer
ggreer / birth_month.py
Created January 26, 2015 18:30
Pypy is *fast*
#!/usr/bin/env python
import random
matches = 0
total = 1000000
people = 5
for i in range(total):
month = random.randrange(12)
for j in reversed(range(people - 1)):
@tarruda
tarruda / keybase.md
Created September 16, 2014 10:01
keybase.md

Keybase proof

I hereby claim:

  • I am tarruda on github.
  • I am tarruda (https://keybase.io/tarruda) on keybase.
  • I have a public key whose fingerprint is 5A71 6962 941B 684F 539E 6CD0 BEC2 61F3 78B2 8824

To claim this, I am signing this object:

@tarruda
tarruda / snake.py
Last active June 11, 2021 00:01
snake.py
# Snake for Neovim! Adapted from https://gist.github.com/sanchitgangwar/2158084
# To install, create a ~/.vim/rplugin/python/snake.py file with this
# code, then run `nvim -c 'UpdateRemotePlugins' -c 'q'` from a shell.
#
# Make sure you have read the internal help explaining how to setup python
# host for external plugins(:help nvim-python)
#
# To start a new game, use the `:SnakeStart` command on an empty buffer(uses 80
# columns and 20 rows)
from threading import Thread, Lock
@staltz
staltz / introrx.md
Last active May 18, 2024 05:17
The introduction to Reactive Programming you've been missing
@mathieulegrand
mathieulegrand / connect.rs
Last active March 10, 2018 19:57
simple connect to server:443 in Rust
// Rust 0.10-pre (Tue Mar 18, 2014)
// $ rustc -L rust-openssl/build/ -L rust-toml/lib doing.rs
// assuming https://github.com/sfackler/rust-openssl is cloned and compiled,
// and https://github.com/mneumann/rust-tom is cloned and compiled
#[feature(macro_rules)];
#[allow(deprecated_owned_vector)];
extern crate openssl;
extern crate serialize;
@jasonrudolph
jasonrudolph / 00-about-search-api-examples.md
Last active April 30, 2024 19:21
5 entertaining things you can find with the GitHub Search API