Skip to content

Instantly share code, notes, and snippets.

View megawac's full-sized avatar

Graeme Yeates megawac

  • Clearpath Robotics
  • Waterloo, Ontario
View GitHub Profile
@jamiebuilds
jamiebuilds / babel-plugin-ideas.md
Last active August 29, 2015 14:18
Babel Plugin Ideas

Babel Plugin Ideas

babel-plugin-backbone

import {View} from 'backbone';

export default class MyView extends View {
  initialize() {
    this.$el.css('color', 'red');
@Sumbera
Sumbera / L.CanvasOverlay.js
Last active February 3, 2023 09:47
Leaflet Canvas Overlay
/*
UPDATE July 2016 , moved and updated to here: https://github.com/Sumbera/gLayers.Leaflet
Generic Canvas Overlay for leaflet,
Stanislav Sumbera, April , 2014
- added userDrawFunc that is called when Canvas need to be redrawn
- added few useful params fro userDrawFunc callback
- fixed resize map bug
inspired & portions taken from : https://github.com/Leaflet/Leaflet.heat
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@megawac
megawac / css-calc-polyfill.js
Last active December 22, 2015 20:18
Mootools css calc polyfill. Only for relatively simple cases. Usage: util.calc($$('div')[8], 'width', '70% - 40px'); This will yield a cross browser calc. It uses native if it should be supported. Only supporting a few units for now.
//http://caniuse.com/#feat=calc
//union bool str (-webkit-calc, -moz-calc, calc)
//alternatively see last version where i did a version check based on can i use
document.addEvent("domready", function() {//based off https://gist.github.com/Rob-ot/3399053
Browser.Features.calc = false;//union bool str (-webkit-calc, -moz-calc, calc)
["","-webkit-","-moz-","-o-"].some(function(prefix) {
var $el = new Element('div', {
styles: {
width: prefix + "calc(5px)"
}
@jdecaron
jdecaron / flash.c
Last active December 19, 2015 10:39
#include <stdio.h>
#include <windows.h>
#include <winsock2.h>
int pid = 0;
STARTUPINFO lpStartupInfo;
PROCESS_INFORMATION lpProcessInformation;
BOOL CALLBACK EnumChildWindowsProc(HWND hwnd, LPARAM lparam){
DWORD p;
@bgrins
bgrins / Log-.md
Last active July 11, 2024 13:40
Prevent errors on console methods when no console present and expose a global 'log' function.

Javascript log Function

Every time I start a new project, I want to pull in a log function that allows the same functionality as the console.log, including the full functionality of the Console API.

There are a lot of ways to do this, but many are lacking. A common problem with wrapper functions is that the line number that shows up next to the log is the line number of the log function itself, not where log was invoked. There are also times where the arguments get logged in a way that isn't quite the same as the native function.

This is an attempt to once and for all document the function that I pull in to new projects. There are two different options:

  • The full version: Inspired by the plugin in HTML5 Boilerplate. Use this if you are writing an application and want to create a window.log function. Additionally,
@font-face {
font-family: 'EntypoRegular';
src: url('font/entypo.eot');
src: url('font/entypo.eot?#iefix') format('embedded-opentype'),
url('font/entypo.woff') format('woff'),
url('font/entypo.ttf') format('truetype'),
url('font/entypo.svg#EntypoRegular') format('svg');
font-weight: normal;
font-style: normal;
}
@Potherca
Potherca / README.md
Last active November 27, 2023 17:44
Create a branch on Github without access to a local git repo using http://hurl.eu/

Ever had the need to create a branch in a repo on Github without wanting (or being able) to access a local repo?

With the aid of [the Github API][1] and any online request app this is a piece of cake!

Just follow these steps:

  1. Open an online request app (like apirequest.io, hurl.it pipedream.com, reqbin.com, or webhook.site)
  2. Find the revision you want to branch from. Either on Github itself or by doing a GET request from Hurl: https://api.github.com/repos/<AUTHOR>/<REPO>/git/refs/heads
  3. Copy the revision hash
  4. Do a POST request from Hurl to https://api.github.com/repos/<AUTHOR>/<REPO>/git/refs with the following as the POST body :
@relay-zz
relay-zz / deferred-min.js
Created September 8, 2012 06:29
Deferred (Twisted API) implementation with no dependencies
/*Copyright(c)2012 relay.github.com http://opensource.org/licenses/MIT*/function Deferred(){this.callbacks=[]} Deferred.prototype={err:0,x:0,$:function(a){this.callbacks.push(a);2==this.x&&this._(this.o);return this},done:function(a){return this.$([a,0])},fail:function(a){return this.$([0,a])},always:function(a){return this.$([0,0,a])},then:function(a,c){return this.$([a,c])},reject:function(a){this.x||(this.err=1,this._(a));return this},resolve:function(a){this.x||this._(a);return this},_:function(a){this.x=1;for(var c=this.err,d=this.callbacks,b=d.shift(),e=a;b;)try{for(;b;){(b=b[2]||(c?b[1]:b[0]))&&(e= b(e||a));if(e instanceof Deferred){var f=this;e.always(function(b){f._(b||a);return b});return}b=d.shift()}}catch(g){c&&(b=d.shift()),this.err=c=1}this.o=e||a;this.x=2}};Deferred.when=function(a,c){if(!c)return a;for(var c=[].slice.call(arguments),a=new Deferred,d=c.length,b=d,e=[],f=function(c){return function(d){e[c]=d;--b||a.resolve(e)}},g=function(b){a.reject(b)};d--;)c[d].then(f(d),g);return a};
@sgillies
sgillies / geo_interface.rst
Last active October 30, 2024 10:58
A Python Protocol for Geospatial Data

Author: Sean Gillies Version: 1.0

Abstract

This document describes a GeoJSON-like protocol for geo-spatial (GIS) vector data.

Introduction