Skip to content

Instantly share code, notes, and snippets.

View tooolbox's full-sized avatar

Matt Mc tooolbox

  • Non-Profit
  • Los Angeles, California
View GitHub Profile
@clintel
clintel / gist:1155906
Created August 19, 2011 02:40
Fenced code in bullet lists with GitHub-flavoured MarkDown??

Fenced code blocks inside ordered and unordered lists

  1. This is a numbered list.

  2. I'm going to include a fenced code block as part of this bullet:

    Code
    More Code
    
@tlberglund
tlberglund / git-loglive
Last active September 26, 2024 20:40
Log Live Git Command
#!/bin/bash
while :
do
clear
git --no-pager log --graph --pretty=oneline --abbrev-commit --decorate --all $*
sleep 1
done
@cacheleocode
cacheleocode / ibooks.js
Last active June 10, 2019 13:49
In iBookstore Asset Guide is a documented javascript library for interactivity in ebooks. After logging in, Select Deliver Your Content Module, Download the iBookstore Fixed Layout EPUB Example, Open the ePub with an editor or Unzip the ePub (I used Textwrangler). Open the JS Folder. There it is! From Textwrangler, I just copied and pasted the c…
/**
* iBooks JS Framework
* Compatibility: iBooks 1.5+
* Copyright © 2009-2011 Apple Inc. All rights reserved.
*
**/
/**
* @name iBooks
* @namespace

Falsehoods programmers believe about prices

  1. You can store a price in a floating point variable.
  2. All currencies are subdivided in 1/100th units (like US dollar/cents, euro/eurocents etc.).
  3. All currencies are subdivided in decimal units (like dinar/fils)
  4. All currencies currently in circulation are subdivided in decimal units. (to exclude shillings, pennies) (counter-example: MGA)
  5. All currencies are subdivided. (counter-examples: KRW, COP, JPY... Or subdivisions can be deprecated.)
  6. Prices can't have more precision than the smaller sub-unit of the currency. (e.g. gas prices)
  7. For any currency you can have a price of 1. (ZWL)
  8. Every country has its own currency. (EUR is the best example, but also Franc CFA, etc.)
@jamonholmgren
jamonholmgren / gist:7238324
Last active April 4, 2021 07:37
I installed Mac OS X Server to check it out. Problem was, it blew away my virtual host setup. Here's how I got them back.

OS X Server disables virtual host setup

I've been using the excellent VirtualHostX to set up my virtual hosts on OS X for a while now. It works great for setting up Apache virtual hosts and local domains.

A couple days ago, I decided to install OS X Server. When I enabled the web server portion, it seemingly disabled my virtual hosts and started showing its own page:

http://d.pr/i/loKD

Apparently, there's no easy way to uninstall OS X Server.

@kerimdzhanov
kerimdzhanov / random.js
Last active September 21, 2024 11:44
JavaScript: get a random number from a specific range
/**
* Get a random floating point number between `min` and `max`.
*
* @param {number} min - min number
* @param {number} max - max number
* @return {number} a random floating point number
*/
function getRandomFloat(min, max) {
return Math.random() * (max - min) + min;
}
@dvschultz
dvschultz / gist:8324974
Created January 8, 2014 21:26
Media Queries: Kindle Fire vs Kindle e-ink.
@media screen and (device-aspect-ratio:1/1) {
/* anything in here will work on Fires. Seriously. */
}
@media not all and (device-aspect-ratio:1/1) {
/* anything in here will work on e-inks */
}
@eoghain
eoghain / UICollectionViewFlowLayout+NoFade.m
Created March 5, 2014 00:16
When adding/removing/reloading cells in a UICollectionView using the FlowLayout the cells fade in/out. When doing things like updating a progress bar you get a lot of annoying flashing because of this, this category will prevent that. As an added benefit rotation animations will now show the cells moving into position.
//
// UICollectionViewFlowLayout+NoFade.m
//
// Created by Rob Booth on 3/4/14.
#import "UICollectionViewFlowLayout+NoFade.h"
#import <objc/runtime.h>
@implementation UICollectionViewFlowLayout (NoFade)
package nettimeout
import (
"net"
"time"
)
// Listener wraps a net.Listener, and gives a place to store the timeout
// parameters. On Accept, it will wrap the net.Conn with our own Conn for us.
type Listener struct {