Skip to content

Instantly share code, notes, and snippets.

View jfreeze's full-sized avatar

Jim Freeze jfreeze

View GitHub Profile
@jfreeze
jfreeze / gist:ab8cf3bb1aaa05d5f2fdc0aadec8c8bb
Last active December 3, 2024 16:25
Create a Postgres Database with Horizon
#
# Postgres Database Creation Example using Horizon
#
#
# Setup a host alias to your FreeBSD instance.
# Example host creation at https://hexdocs.pm/horizon/readme.html
#
$ sudo sh -c 'echo "178.156.153.23\t\tdemo-pg" >> /etc/hosts'
@jfreeze
jfreeze / tailwindsetup.txt
Last active July 15, 2022 17:54
TailwindCSS Setup
mix phx.new app_name
cd app_name
cd assets
npm install tailwindcss @tailwindcss/ui postcss-import postcss-loader --save-dev
npx tailwindcss init
npx tailwind init tailwindcss-full.js --full
# Change the app dir to your app dir!
const glob = require('glob');
const fs = require('fs');
// Locate lib/<app>_web/ to locate .l?eex files
const files = fs.readdirSync('../lib/');
const appWeb = files.filter((file) => file.endsWith("_web"))[0]
const searchPath = '../lib/' + appWeb + '/**/*eex'
const purgecss = require('@fullhuman/postcss-purgecss')({
// Specify the paths to all of the template files in your project
const path = require('path');
const glob = require('glob');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = (env, options) => ({
optimization: {
minimizer: [
[postcss] ...prod mode detected, purging css
Hash: d1f9561b23eda5f7f0f9
Version: webpack 4.42.0
Time: 4017ms
Built at: 03/02/2020 11:12:02 PM
1 asset
Entrypoint ./js/app.js = app.js
[0] multi ./js/app.js 28 bytes {0} [built]
[1] ./js/app.js 493 bytes {0} [built]
[2] ./css/app.css 1.36 KiB {0} [built]
@jfreeze
jfreeze / iex
Created August 21, 2015 14:03
Binary pattern matching
iex(5)> <<"fred", ?\n>>
"fred\n"
iex(6)> << x, ?\n>> = "fred\n"
** (MatchError) no match of right hand side value: "fred\n"
@jfreeze
jfreeze / distro_calc.ex
Created September 26, 2014 14:33
Distro.DistroCalc logging
defmodule Distro.DistroCalc do
use GenServer
require Logger
def start_link do
GenServer.start_link(__MODULE__, [], name: {:global, __MODULE__})
end
def add(x,y) do
Logger.info "self: #{inspect Node.self}"
@jfreeze
jfreeze / gist:b455b5c1728f9a71af24
Created April 30, 2014 16:35
Mix.exs dependencies
In mix.exs of MyApp
def application do
[
mod: { MyApp, [] },
applications: [ :httpoison ],
env: [
account: [ company: "WIC" ]
]
]
end
@jfreeze
jfreeze / gist:10736240
Created April 15, 2014 14:16
Date Formatting
{{y,m,d},{_,_,_}} = :calendar.universal_time
to_string(List.flatten(:io_lib.fwrite("~2.2.0w/~2.2.0w/~w", [m,d,y])))
@jfreeze
jfreeze / gist:9423233
Created March 8, 2014 00:34
Installing Elixir on Raspberry Pi
My quick notes on what I did to install Elixir on the Raspberry Pi.
All the info is here, but it's a self guided tour.
# Get Raspbian
http://www.raspberrypi.org/downloads
http://downloads.raspberrypi.org/raspbian_latest
# Copy raspbian.img file to th SD Card
diskutils unmountDisk /dev/disk<numberhere>