Skip to content

Instantly share code, notes, and snippets.

View mkelley33's full-sized avatar
🎯
Focusing

Michaux Kelley mkelley33

🎯
Focusing
View GitHub Profile
@mkelley33
mkelley33 / gist:eb1549dddb65672a0724c2a91bd873fc
Created February 25, 2024 21:53
zsh script to replace all spaces and special characters in a file name for all files in the directory with dashes and make all letters lowercase removing the last dash in the file name
#!/bin/zsh
# Iterate over files in the directory
for filename in *; do
# Check if the filename is a regular file
if [[ -f "$filename" ]]; then
# Extract filename and extension
base_filename=$(basename "$filename")
extension="${base_filename##*.}"
base_filename="${base_filename%.*}"
@mkelley33
mkelley33 / simple-pagination.js
Created February 9, 2024 23:39 — forked from kottenator/simple-pagination.js
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
@mkelley33
mkelley33 / webpack.config.js
Created November 20, 2016 00:42
webpack-dashboard config
const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
// add
const Dashboard = require('webpack-dashboard');
const DashboardPlugin = require('webpack-dashboard/plugin');
const dashboard = new Dashboard();
// add
@mkelley33
mkelley33 / osx_install.sh
Last active August 29, 2015 14:25 — forked from t-io/osx_install.sh
Homebrew: brew cask and brew installs of apps common to my dev machine
#!/bin/sh
export HOMEBREW_CASK_OPTS="--appdir=/Applications"
echo Install Homebrew, Postgres, wget and cask
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
brew tap homebrew/dupes
brew install wget
brew install postgresql
brew install mongodb
brew install mongoose
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@mkelley33
mkelley33 / .ackrc
Created March 7, 2014 23:16
My .ackrc
# Always sort the files
--sort-files
# Always color, even if piping to a another program
--color
# Use "less -r" as my pager
--pager=less -r
# File type search options
Mongoid.connect_to 'mongoid-3144'
class Post
include Mongoid::Document
field :name
embeds_many :comments
accepts_nested_attributes_for :comments
# This line somehow triggers the bug; commenting it out fixes the bug, wierd.
@mkelley33
mkelley33 / mkelley33-pryrc.rb
Last active December 17, 2015 12:29
My .pryrc
# encoding: UTF-8
Pry.config.editor = "vim"
Pry.config.pager = false
Pry.config.commands.alias_command "lM", "ls -M"
if defined?(Encoding) then
Encoding.default_external = 'utf-8'
Encoding.default_internal = 'utf-8'
else
$KCODE = 'utf-8'
@mkelley33
mkelley33 / best_in_place_fix.js.coffee
Created December 3, 2012 07:43
best_in_place: fix disappearing line-breaks in textarea
jQuery ->
$('[id^="best_in_place_your_object_"],[id$="address"]').on 'best_in_place:update', (event) ->
$address = $(event.target)
$address.data('bestInPlaceEditor').original_content = $address.html()
$address.html $address.html().replace(/[\n\r]+/g, '<br>')