Skip to content

Instantly share code, notes, and snippets.

View jfreeze's full-sized avatar

Jim Freeze jfreeze

View GitHub Profile
@jfreeze
jfreeze / gist:8894279
Last active April 2, 2024 08:15
Get VI bindings in IEX (Elixir REPL)
# VI bindings in iex:
brew install rlwrap # on OSX
echo "alias iex='rlwrap -a foo iex'" >> ~/.bash_profile
echo "set editing-mode vi" >> ~/.inputrc
source ~/.bash_profile
# To run iex WITHOUT rlwrap
\iex
@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]
iex(3)> s2=File.stream!("APP_FL.uncompressed.pdf")
#Function<17.133702391 in Stream.resource/3>
iex(4)> Enum.map(s2, fn line -> IO.puts line end )
%PDF-1.5
** (ArgumentError) argument error
:io.put_chars(#PID<0.25.0>, :unicode, [<<37, 226, 227, 207, 211, 10>>, 10])
/Users/jimfreeze/.kiex/builds/elixir-git/lib/elixir/lib/enum.ex:885: Enum."-map/2-fun-0-"/3
/Users/jimfreeze/.kiex/builds/elixir-git/lib/elixir/lib/stream.ex:923: Stream.do_resource/5
/Users/jimfreeze/.kiex/builds/elixir-git/lib/elixir/lib/stream.ex:934: Stream.do_resource/5
@jfreeze
jfreeze / gist:8602632
Created January 24, 2014 18:01
PDF Download Headers
Sinatra
Connection:keep-alive
Content-Disposition:attachment; filename='quote.pdf'
Content-Length:114372
content-type:application/pdf; charset=utf-8
Server:thin 1.6.1 codename Death Proof
X-Content-Type-Options:nosniff
@jfreeze
jfreeze / app.js
Created May 15, 2013 12:56
Adjust ember-data url to add .json
http://stackoverflow.com/questions/14828478/ember-js-ember-data-restadapter-fail-to-load-json
// TravelClient.CUSTOMAdapter = DS.RESTAdapter.extend({
bulkCommit: false,
url: "http://remote_server_address",
buildURL: function(record, suffix) {
var s = this._super(record, suffix);
return s + ".json";
}
})
☺ ➔ xiki menu
pid-file for killed process 9278 found (/tmp/xiki_process.rb.pid), deleting.
/Users/jdf/.rvm/gems/ruby-1.9.2-p290/gems/xiki-0.6.3/etc/command/xiki_command.rb:129:in `gets': execution expired (Timeout::Error)
from /Users/jdf/.rvm/gems/ruby-1.9.2-p290/gems/xiki-0.6.3/etc/command/xiki_command.rb:129:in `block (2 levels) in get_response'
from /Users/jdf/.rvm/gems/ruby-1.9.2-p290/gems/xiki-0.6.3/etc/command/xiki_command.rb:124:in `open'
from /Users/jdf/.rvm/gems/ruby-1.9.2-p290/gems/xiki-0.6.3/etc/command/xiki_command.rb:124:in `block in get_response'
from /Users/jdf/.rvm/gems/ruby-1.9.2-p290/gems/xiki-0.6.3/etc/command/xiki_command.rb:121:in `get_response'
from /Users/jdf/.rvm/gems/ruby-1.9.2-p290/gems/xiki-0.6.3/etc/command/xiki_command.rb:102:in `run'
from /Users/jdf/.rvm/gems/ruby-1.9.2-p290/gems/xiki-0.6.3/bin/xiki:30:in `<top (required)>'
from /Users/jdf/.rvm/gems/ruby-1.9.2-p290/bin/xiki:19:in `load'
~ # esxcli software vib install -v scsi-3w-sas-3.26.00.003vm50-1OEM.500.0.0.472560.x86_64.vib
[VibDownloadError]
('scsi-3w-sas-3.26.00.003vm50-1OEM.500.0.0.472560.x86_64.vib', '', "[Errno 4] IOError: <urlopen error [Errno 2] No such file or directory: '/var/log/vmware/scsi-3w-sas-3.26.00.003vm50-1OEM.500.0.0.472560.x86_64.vib'>")
url = scsi-3w-sas-3.26.00.003vm50-1OEM.500.0.0.472560.x86_64.vib
Please refer to the log file for more details.