Skip to content

Instantly share code, notes, and snippets.

View ckhampus's full-sized avatar

Cristian Hampus ckhampus

View GitHub Profile
@ckhampus
ckhampus / gist:4761831
Last active December 12, 2015 10:49
Typemap b2Vec2 to Microsoft.Xna.Framework.Vector2.
%typemap(cstype, out="Microsoft.Xna.Framework.Vector2") const b2Vec2& "Microsoft.Xna.Framework.Vector2"
%typemap(csin, pre=" b2Vec2 temp$csinput = new b2Vec2($csinput.X, $csinput.Y);") const b2Vec2 & "$csclassname.getCPtr(temp$csinput)"
%typemap(cstype) b2Vec2 "Microsoft.Xna.Framework.Vector2"
%typemap(csout, excode=SWIGEXCODE) b2Vec2 %{
IntPtr cPtr = $imcall;$excode
$csclassname temp = null;
if (cPtr != IntPtr.Zero) {
temp = new $csclassname(cPtr, $owner);
return new Microsoft.Xna.Framework.Vector2(temp.x, temp.y);
@ckhampus
ckhampus / iterator.php
Created April 3, 2014 05:56
PHP Parent Array Iterator
<?php
$data = array(
array(
'id' => 1,
'children' => array(
array(
'id' => 12,
'children' => array(
// The max-widths for the breakpoints
$breakpoints: (
small: 568px,
medium: 1000px,
large: 1180px,
);
$breakpoints: map-merge($breakpoints, (
small-only: max-width map-get($breakpoints, 'medium'),
medium-only: (map-get($breakpoints, 'small') + 1px) map-get($breakpoints, 'medium'),
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
@ckhampus
ckhampus / bottom-bar.jsx
Last active December 1, 2017 10:19
Bottom Bar POC
import { h, Component } from 'preact';
//
// Basic building blocks
//
export const BottomBar = ({ children, visible, expanded }) => {
const styles = [
'bottom-bar',
visible && 'bottom-bar--visible',
expanded && 'bottom-bar--expanded',