Skip to content

Instantly share code, notes, and snippets.

View DylanFM's full-sized avatar

Dylan Fogarty-MacDonald DylanFM

View GitHub Profile
@toolmantim
toolmantim / brunch_uglify.coffee
Last active December 13, 2015 18:58
Various configurations to ensure newlines are preserved in minified Javascript files. Fork it and add another language/framework/compressor combination!
# Brunch - http://brunch.io/
#
# Using uglify-js-brunch - https://github.com/brunch/uglify-js-brunch
#
# Use the following settings in your Brunch configuration file
exports.config =
plugins:
uglify:
output:
@ghalimi
ghalimi / IRR.js
Created January 22, 2013 01:45
IRR Function
// Copyright (c) 2012 Sutoiku, Inc. (MIT License)
// Some algorithms have been ported from Apache OpenOffice:
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
require 'redis'
# the heart of the message bus, it acts as 2 things
#
# 1. A channel multiplexer
# 2. Backlog storage per-multiplexed channel.
#
# ids are all sequencially increasing numbers starting at 0
#
class MessageBus::Message < Struct.new(:global_id, :message_id, :channel , :data)
@ndarville
ndarville / business-models.md
Last active February 27, 2025 10:00
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@benschwarz
benschwarz / Readme.md
Created November 12, 2012 11:59
Use postmarkapp.com and YQL to deliver email

Howto:

  • Run an insert statement to YQL, storing your API Key with a use statement linking to this gist.
insert into yql.storage.admin (value) values ("
use 'https://raw.github.com/gist/5ceb77a28686513f16a7/cb17fcb095847f320426fb0fc5261d47cf62b0d8/postmark.xml' as postmark;
set api_key='YOUR KEY HERE' on postmark;
")
Don't go to Fishermans Wharf. Drive out to Santa Cruz, Muir Woods, Point Reyes, Napa and Sonoma.
If you want to spend 500USD on a meal then get a ticket to Saison Chef's Counter. Highly recommended.
Walk around Embarcadero. Check out Golden Gate Park. Do you like to ride bicycles?
Head to Umi and Tataki South for sushi. Head to Chez Maman and Papito. Piccino. Plow for brunch, be sure to have the potatoes.
Don't do brunch on the weekend though. You'll always have to wait. Weekdays are best.
@toolmantim
toolmantim / 1 Readme.md
Created July 26, 2012 19:39
Minification with newlines using the Rails 3 asset pipeline

Retaining line numbers with the Rails asset pipeline

By default the Rails 3 asset pipeline uses the Uglifier gem to optimize and minify your Javascript. One of its many optimisations is to remove all whitespace, turning your Javascript into one very long line of code.

Whist removing all the newlines helps to reduce the file size, it has the disadvantage of making your Javascript harder to debug. If you've tried to track down Javascript errors in minified Javascript files you'll know the lack of whitespace does make life harder.

Luckily there is a simple solution: to configure Uglifier to add newlines back into the code after it performs its optimisations. And if you're serving your files correctly gzip'd, the newlines add only a small increase to the final file size.

You can configure Uglifier to add the newlines by setting the following in your Rails 3 config/production.rb file:

@jimworm
jimworm / change_validator.rb
Created July 20, 2012 07:51
Enforce/prevent attribute change in Rails 3
class ChangeValidator < ActiveModel::EachValidator
# Enforce/prevent attribute change
#
# Example: Make attribute immutable once saved
# validates :attribute, change: false, on: :update
#
# Example: Force attribute change on every save
# validates :attribute, change: true
def initialize(options)
@witoldsz
witoldsz / angular-auth.js
Created July 14, 2012 14:30
Angular Auth (work-in-progress)
/**
* @license Angular Auth
* (c) 2012 Witold Szczerba
* License: MIT
*/
angular.module('angular-auth', [])
/**
* Holds all the requests which failed due to 401 response,
* so they can be re-requested in the future, once login is completed.
@dylanegan
dylanegan / gist:3039155
Created July 3, 2012 11:20
Berlin food sources
http://www.frischeparadies.eu/?view=featured
http://www.markthalle9.de/
http://www.meine-markthalle.de/
http://www.exberliner.com/articles/the-ethical-carnivore/
http://www.fleischerei-gerlach.de/index.html
http://www.neuland-kluge.de/
http://www.fleischerei-buenger.de/