Skip to content

Instantly share code, notes, and snippets.

package main
import (
"encoding/json"
"log"
"net/http"
"strconv"
)
func writeJson(rw http.ResponseWriter, v interface{}) {
package main
import (
"encoding/json"
"log"
"net/http"
"strconv"
)
func writeJson(rw http.ResponseWriter, v interface{}) {
Nicos-MacBook-Pro:ggbuilds nico$ go build *.go
# command-line-arguments
./write_json.go:1: missing return at end of function
@clooth
clooth / gist.m
Created September 11, 2013 13:47
Thumbnail generator from assets
- (CGImageRef)thumbnailImageForAsset:(ALAsset *)asset
maxPixelSize:(NSUInteger)size
{
NSParameterAssert(asset != nil);
NSParameterAssert(size > 0);
ALAssetRepresentation *assetRepresentation = [asset defaultRepresentation];
CGDataProviderDirectCallbacks callbacks = {
.version = 0,
@clooth
clooth / sfml.rb
Last active December 23, 2015 09:28 — forked from blt/sfml.rb
require 'formula'
# Documentation: https://github.com/mxcl/homebrew/wiki/Formula-Cookbook
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
class Sfml < Formula
homepage 'http://www.sfml-dev.org'
version '2.0'
url 'http://www.sfml-dev.org/download/sfml/2.1/SFML-2.1-sources.zip'
@clooth
clooth / sfml.rb
Last active December 23, 2015 09:28 — forked from blt/sfml.rb
require 'formula'
# Documentation: https://github.com/mxcl/homebrew/wiki/Formula-Cookbook
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
class Sfml < Formula
homepage 'http://www.sfml-dev.org'
version '2.0'
url 'http://www.sfml-dev.org/download/sfml/2.1/SFML-2.1-sources.zip'
#include <SDL2/SDL.h>
#include <stdio.h>
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
int main(int argc, char* args[])
{
// Main rendering window
SDL_Window* window = NULL;
/**
Loads a BMP image into a texture on the rendering device
@param file The BMP image file to load
@param renderer The renderer to load the texture onto
@return the loaded texture, or nullptr if something went wrong.
*/
SDL_Texture *loadTexture(const std::string &file, SDL_Renderer *renderer)
{
SDL_Surface *loadedImage = SDL_LoadBMP(file.c_str());
@clooth
clooth / dl.js
Created September 18, 2013 23:55
var downloadURL = function(a) {
var b = "hiddenDownloader" + (+new Date()),
c = document.getElementById(b);
null === c && (c = document.createElement("iframe"), c.id = b, c.style.display = "none", document.body.appendChild(c)), c.src = a
};
window.zips = document.querySelectorAll('a.tutLink[href$=zip]');
var i = 0;
for (var i; i < window.zips.length; i++) {
var zip = window.zips[i];
downloadURL(zip.href);
long colorFromHexString(std::string hexString)
{
return strtol(hexString.c_str(), NULL, 16);
}
std::vector<Uint32> rgbFromColor(long colorValue)
{
std::vector<Uint32> rgb;
// Red, Green, Blue