Skip to content

Instantly share code, notes, and snippets.

View jeffjewiss's full-sized avatar

Jeff Jewiss jeffjewiss

View GitHub Profile
@mcrumm
mcrumm / phx_sqlite_fly_launch.md
Last active January 15, 2024 07:49
Phoenix + SQLite Deployment tips

Deploying to Fly.io with SQLite

Deploying a Phoenix app to Fly.io is a breeze...is what everyone kept telling me. In fairness, I imagine the process would have been breezier had I just used postgres, but all the sqlite and litestream talk has been far too intriguing to ignore. "Wait", you say. "It is just a flat file. How much harder can it be?"

It is easy to make something harder than it should be. It is hard to take something complex and make it truly simple. flyctl launch does an amazing job at providing a simple interface to the utterly complex task of generating deployment resources, especially now that we are living in a containerd (erm, firecracker) world.

This gist is for anyone who, like me, thinks they know better than to read all of the documentation and therefore necessari

@atomkirk
atomkirk / endpoint.ex
Created February 23, 2018 16:50
raw body plug parser
plug Plug.Parsers,
parsers: [ZB.Parsers.RAWBODY, :urlencoded, :multipart, :json],
pass: ["*/*"],
json_decoder: Poison
defmodule EvercamMedia.SnapmailController do
...
def update(conn, %{"id" => snapmail_exid} = params) do
current_user = conn.assigns[:current_user]
with :ok <- authorized(conn, current_user),
{:ok, cameras} <- ensure_cameras_exist("update", conn, params["camera_exids"], current_user),
{:ok, snapmail} <- snapmail_exist(conn, snapmail_exid),
true <- snapmail.user_id == current_user.id
do
@henrik
henrik / deploying_phoenix_on_dokku.md
Last active April 14, 2024 00:32
Deploying Elixir's Phoenix Framework on Dokku.

Deploying Phoenix on Dokku

Worked 2015-09-08 for Phoenix 1.0.1 on Dokku 0.3.25.

These instructions assume you've set up Dokku. If not, go find a tutorial for that part. My notes for setting it up on Digital Ocean.

On your local machine, in the app's repo

Create a Dokku app:

@rauchg
rauchg / effective-es6.md
Last active July 11, 2023 09:38
Writing ES6 today, effectively.

Effective transpiling of ES6

After publishing my article on ECMAScript 6, some have reached out to ask how I exactly I make it all work.

I refrained from including these details on the original post because they're subject to immiment obsoletion. These tools are changing and evolving quickly, and some of these instructions are likely to become outdated in the coming months or even weeks.

The main tool

When evaluating the available transpilers, I decided to use 6to5, which has recently been renamed to Babel. I chose it based on:

@booleanbetrayal
booleanbetrayal / Gruntfile.js
Last active November 9, 2023 18:59
Example GruntJS configuration for a replacement to the Sprockets Rails asset pipeline
'use strict';
module.exports = function(grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// configurable paths
var paths = {
@zachleat
zachleat / reading_time.rb
Last active October 21, 2020 23:00
Read this in X minutes Liquid Filter Plugin (for Jekyll)
# Outputs the reading time
# Read this in “about 4 minutes”
# Put into your _plugins dir in your Jekyll site
# Usage: Read this in about {{ page.content | reading_time }}
module ReadingTimeFilter
def reading_time( input )
words_per_minute = 180
@NahimNasser
NahimNasser / weekly_git_log_generator.py
Created February 12, 2013 18:39
Git log summary, week by week for your entire project.
"""
Outputs a week by week commit log with one line commit messages for your entire git repository
from start to finish
"""
import commands
import datetime
status, start_date = commands.getstatusoutput("git log --date=short --format='%cd' --reverse | head -1")
status, end_date = commands.getstatusoutput("git log --date=short --format='%cd' -1")
@agnoster
agnoster / README.md
Last active April 6, 2024 22:35
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@mrrooijen
mrrooijen / README.md
Created August 15, 2012 01:30
Heroku SSL Endpoint, RapidSSL

Heroku SSL Endpoint

Assumptions:

  • You want to enable SSL for your domain.
  • You want to go with RapidSSL.
  • Your domain name is www.domain.com during this example.
  • You want to encrypt requests for a single domain (no wildcard)
  • You want to apply this certificate to Heroku's SSL Endpoint