Skip to content

Instantly share code, notes, and snippets.

View coffeejunk's full-sized avatar
:shipit:

Maximilian Haack coffeejunk

:shipit:
View GitHub Profile
@coffeejunk
coffeejunk / mail.rb
Created August 6, 2011 10:59 — forked from dennisreimann/mail.rb
CIJoe mail notification script.
#!/usr/bin/env ruby
# CIJoe mail notification script.
# Some things in here are shamelessly ripped from
# http://gist.github.com/374030
#
# Call this from your hooks (build-worked, build-failed) with something like:
# ~/ci/scripts/mail.rb ~/ci/PROJECT/ CIJOE_URL BRANCH
#
# Requirements
@coffeejunk
coffeejunk / Questions
Created August 9, 2011 06:44
Frozen Rails Give-away
Day job: student & ceo of octothorp.eu
Your Rails contributions (if any): none, so far.
What's your Ruby/Rails experience?: 1,5 months.. And the crowd goes wild.
How do you use GitHub?: I use GitHub to convince the people I work with to use git. (and of course all the good stuff, code review, issues(!), wiki, gists, not forgetting about projects that might be interesting -> following)
@coffeejunk
coffeejunk / bot.rb
Created September 29, 2011 07:32 — forked from joakimk/bot.rb
XMPP/Ruby Bot for HipChat with support for multiple rooms
#!/usr/bin/env ruby
require 'rubygems'
require 'xmpp4r'
require 'xmpp4r/muc/helper/simplemucclient'
# Most of this is borrowed from https://gist.github.com/941931
# Added support for multiple rooms and external handling of messages.
# We want the MUC functionality to just handle shit for us. Unfortunately we
# have to override/repeat the join method in order to add the directive that
@coffeejunk
coffeejunk / pr.md
Created January 12, 2013 12:04 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

# app/controllers/users/password_controller.rb
class Users::PasswordsController < Devise::PasswordsController
def resource_params
params.require(:user).permit(:email, :password, :password_confirmation)
end
private :resource_params
end
# https://www.varnish-cache.org/docs/2.1/tutorial/vcl.html
# https://www.varnish-cache.org/trac/wiki/VCLExamples
# Summary
# 1. Varnish will poll the backend at /health_check to make sure it is
# healthy. If the backend goes down, varnish will server stale content
# from the cache for up to 1 hour.
# 2. Varnish will pass X-Forwarded-For headers through to the backend
# 3. Varnish will remove cookies from urls that match static content file
# extensions (jpg, gif, ...)

Notes

This is the latest version of an email which I send periodically, offering customers the opportunity to pre-pay for SaaS in return for a discount. The benefits to the SaaS company are better cash flow and reduced churn rate. The benefits to the customer are, well, in the email. This genre of email has produced hundreds of thousands of dollars in pre-pays for some companies I work with, and it rarely requires any more work than this example.

I've put $79 is as a placeholder for the cost of the user's plan. We calculate that for each account, naturally, along with the billing contact's name.

Subject: Save $79 on Appointment Reminder (and get a tax write-off) Formatting: 100% plain text. Gmail automatically links up the central link. From: Patrick McKenzie (Appointment Reminder) [email protected]

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.
@coffeejunk
coffeejunk / infoClickHandler.js
Created June 1, 2020 14:10 — forked from xemoka/infoClickHandler.js
infoClickHandler
function infoClickHandler (event) {
console.log('Info Click Handler Fired:', event)
let currentInfos = [] // the array we'll fill with the data returned from arcgis Server
// get pixel click location
const pixel = mapElement.getEventPixel(event.originalEvent)
// generate list of layers
let layers = []