Skip to content

Instantly share code, notes, and snippets.

View enigmaticape's full-sized avatar

Enigmatic Ape enigmaticape

View GitHub Profile
.gist .line,
.gist .line-number {
font-size:14px !important;
line-height:25px !important;
}
@enigmaticape
enigmaticape / EnigmaticApe_ShortExcerpts_WP_Plugin.php
Last active December 12, 2015 09:19
Wordpess plugin that adds an extra post meta box for a short (or just additional) excerpt. Bung it in your wp-content/plugins directory, get the short excerpt using : get_post_meta($post->ID, "ape_short_excerpt", true) ) :
<?php
/*
Plugin Name: Add Short Excerpt Meta
Plugin URI: https://gist.github.com/enigmaticape/4751121
Description: Add an additional excerpt box for front page
Version: 1.0
Author: Steve Trewick
Author URI: http://www.enigmaticape.com
License: Public Domain
*/
@enigmaticape
enigmaticape / topgrossingfreeapps.py
Last active May 29, 2017 12:49
Grab and parse iTunes App Store RSS feed and coiunt how many of the top grossing apps for a particular store are currently free
#!/usr/bin/env python
# topgrossingfreeapps.py [country code]
# us, gb, ch, etc
# quick and dirty python script to grab the percentage
# of top grossing aps in a given app store which are
# currently free
import feedparser
@enigmaticape
enigmaticape / inject.js
Created May 19, 2013 21:56
Hack mouse zoom into safari via extension javascript.
zoomWithWheel = false;
zoomLevel = 1;
zoomIncrement = 0.2;
document.addEventListener( "mousewheel", function( event ) {
if( zoomWithWheel ) {
if( event.wheelDeltaY > 0 ) {
zoomLevel += zoomIncrement;
}
@enigmaticape
enigmaticape / manifest.json
Created May 28, 2013 10:49
Chrome extension to enable mouse wheel zooming. Click the middle button and use the wheel to zoom, increments of 20%. There's no options yet, and it cancels auto scroll and opening links in new tab with the middle click.
{
"manifest_version": 2,
"name": "Wheel Zoom",
"description": "Mouse Wheel Zooming.",
"version": "1.0",
"permissions": [
"tabs",
"https://*/*",
@enigmaticape
enigmaticape / gist:5672229
Created May 29, 2013 17:46
I needed a quick spike to demonstrate queueing N asynchronous tasks on a GCD queue. So here it is, just in case you ever need to, you know, asynchronously execute N muppets in batches of M. Well, you never know.
//
// AppDelegate.m
// GCD_SPIKE_2
//
// Created by Steve Trewick on 29/05/2013.
// Copyright (c) 2013 Enigmatic Ape. All rights reserved.
//
#import "AppDelegate.h"
#import <dispatch/dispatch.h>
@enigmaticape
enigmaticape / gist:8455411
Created January 16, 2014 13:58
Generate sine wave data.
void sineWaveSamples( int num_of_samples, double *buffer) {
double frequency = 260;
double sample_rate = 8000;
double increment = 2.0 * M_PI * (frequency / sample_rate);
double amplitude = 0.25;
static double theta = 0;
for( UInt32 i = 0; i < num_of_samples; i++ ) {
@enigmaticape
enigmaticape / gist:8456110
Last active January 3, 2016 11:29
More general form of sine wave sample data generation
typedef struct _WaveState {
double amplitude;
double increment;
double theta;
} WaveState;
void fillWaveSamples( WaveState * state, UInt32 number_of_samples, Float32 * buffer) {
@enigmaticape
enigmaticape / gist:8456297
Last active January 3, 2016 11:29
Rendering callback using more general code.
OSStatus RenderToneWithState
(
void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData
)
{
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>FormatVersion</key>
<string>1.2</string>
<key>RunDestination</key>
<dict>
<key>Name</key>
<string>iPhone Retina (4-inch)</string>