Skip to content

Instantly share code, notes, and snippets.

@WebPlatformDocs
WebPlatformDocs / dabblet.css
Created May 23, 2013 08:07
The first commented line is your codelet’s title
/**
* The first commented line is your codelet’s title
*/
p {
color: #f06;
font: italic 200% Georgia, serif;
transition: 1s cubic-bezier(.2,.6,.8,.8);
width: 200px;
}
@eriksk
eriksk / gist:5633399
Last active December 17, 2015 15:39
OpenGL render a spinning colored cube in Ruby
require 'opengl'
include Gl, Glu, Glut
WIDTH = 512
HEIGHT = 512
NEAR = 0.1
FAR = 1000
class Vec3
attr_accessor :x, :y, :z
@uzzu
uzzu / Bezier.template.xml
Created May 22, 2013 04:26
MonoDevelop code snippets example. Add to ``~/Library/MonoDevelop-Unity-2.8/Snippets``
<?xml version="1.0" encoding="utf-8"?>
<CodeTemplates version="3.0">
<CodeTemplate version="2.0">
<Header>
<_Group>UnityC#</_Group>
<Version />
<MimeType>text/x-csharp</MimeType>
<Shortcut>B_</Shortcut>
<_Description />
<TemplateType>Unknown</TemplateType>
@clouddueling
clouddueling / keypress enter only.js
Created May 22, 2013 04:00
listens for keypress enter only. great for textareas when you don't need ALL of angular-ui
directives.directive('ngEnter', function(){
return {
restrict: 'A',
link: function(scope, elem, attr, ctrl) {
elem.bind('keypress', function(e, ui){
if (e.keyCode == '13') {
scope.$apply(function(s) {
s.$eval(attr.ngEnter);
});
}
@ryansturmer
ryansturmer / midi.py
Last active December 17, 2015 14:29
Some functions for dealing with MIDI and music data. Can't say how many times I've re-written these over the years. Bonus demo function written using pygame (poll a midi input device and print events to the console)
NOTES_SHARP = ["C", "C#", "D", "D#", "E", "F", "F#", "G","G#", "A","A#","B"]
NOTES_FLAT = ["C", "Db", "D", "Eb", "E", "F", "Gb", "G","Ab", "A","Bb","B"]
def generate_midi_event_map():
events = ['Note Off',
'Note On',
'Polyphonic Aftertouch',
'Control Mode Change',
'Program Change',
'Channel Aftertouch',
@mm-git
mm-git / StaticMap.js
Created May 22, 2013 03:02
This add a static map function to jQuery as a plug-in. Poly-line is available. The canvas is needed on your browser. Usage : $("<div>").css({width:200,height:200}).staticMap(point, lines, zoom); point and lines(array) are google.maps.LatLng object.
(function($){
var TILE_SIZE = 256;
var TILE_URL = "http://tile.openstreetmap.org/";
$.fn.staticMap = function(point, lines, zoom){
return this.each(function(i){
var _this = this;
var width = $(this).width();
var height = $(this).height();