Skip to content

Instantly share code, notes, and snippets.

View kyleconroy's full-sized avatar
⌨️
Developing sqlc

Kyle Gray kyleconroy

⌨️
Developing sqlc
View GitHub Profile

How to cross compile Go with CGO programs for a different OS/Arch

It is possible to compile Go programs for a different OS, even though go build says otherwise.

You'll need:

How to cross compile Go with CGO programs for a different OS/Arch

It is possible to compile Go programs for a different OS, even though go build says otherwise.

You'll need:

local Gamestate = require 'vendor/gamestate'
local Prompt = require 'prompt'
local Timer = require 'vendor/timer'
local hiddendoortrigger = {}
hiddendoortrigger.__index = hiddendoortrigger
-- Nodes with 'isInteractive' are nodes which the player can interact with, but not pick up in any way
hiddendoortrigger.isInteractive = true
function hiddendoortrigger.new(node, collider)
@kyleconroy
kyleconroy / test.py
Created April 20, 2012 21:40 — forked from RobSpectre/test.py
Failure to patch accurately
import unittest
from mock import patch
class Class:
def __init__(self):
self.foo = 'bar'
class TestClass(unittest.TestCase):
@patch('__main__.Class')
def test_class(self, MockClass):
@kyleconroy
kyleconroy / gist:1713519
Created January 31, 2012 22:39 — forked from TMcManus/gist:1711143
Number Formatting Functions
<?php
/**
* This function will take a number in a variety of formats and reformat
* the number to be in E.164 format. Currently this is really, really ugly,
* but it works. substr() based function might also work. Currently US only.
*/
function normalizeNumber($number) {
$number = trim($number);
$number = preg_replace("/[^A-Za-z0-9]/", '', $number);