Skip to content

Instantly share code, notes, and snippets.

View bredfern's full-sized avatar

Brian Redfern bredfern

View GitHub Profile
/*
Functional programming in C
```````````````````````````
This is an example of how to use executable memory to get partial function
application (i.e. bind1st()) in C. (Well, this actually only compiles as C++
since i'm using a varargs typedef, but there's no classes or templates.)
To proceed, we need to be comfortable with the cdecl and stdcall calling
conventions on x86, and just a little assembly.
// force certain pages to be refreshed every time. mark such pages with
// 'data-cache="never"'
//
jQuery('div').live('pagehide', function(event, ui){
var page = jQuery(event.target);
if(page.attr('data-cache') == 'never'){
page.remove();
};
});
@bredfern
bredfern / jakesine.c
Created December 1, 2012 19:24 — forked from jacobjoaquin/jakesine.c
first Csound opcode
#include "csdl.h"
#include "jakesine.h"
int jakesine_init (CSOUND *csound, JAKESINE *p)
{
p->inc = *p->freq_in * csound->tpidsr;
p->phase = *p->phase_in * TWOPI;
return OK;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Sample Form</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js"></script>
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<script type="text/javascript">
# A simple Makefile alternative to using Grunt for your static asset compilation
#
## Usage
#
# $ npm install
#
# And then you can run various commands:
#
# $ make # compile files that need compiling
# $ make clean all # remove target files and recompile from scratch
Tempo-Synced LFO Wobble Bass
Jacob Joaquin
July 10, 2011
jacobjoaquin@gmail.com
csoundblog.com
<CsoundSynthesizer>
<CsInstruments>
sr = 44100
kr = 44100
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<link rel="import" href="../core-animated-pages/core-animated-pages.html">
<link rel="import" href="../core-animated-pages/transitions/hero-transition.html">
<link rel="import" href="../core-animated-pages/transitions/cross-fade.html">
<link rel="import" href="../core-animated-pages/transitions/slide-down.html">
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
/* Trello Node.js Developer Challenge - Solution
*
* https://trello.com/jobs/developer
*
* If hash is defined by the following pseudo-code:
*
* Int64 hash (String s) {
* Int64 h = 7
* String letters = "acdegilmnoprstuw"
* for(Int32 i = 0; i < s.length; i++) {
@bredfern
bredfern / html5-video-streamer.js
Created December 8, 2015 00:43 — forked from paolorossi/html5-video-streamer.js
Node.js HTML5 video streamer
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
*/
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';