Skip to content

Instantly share code, notes, and snippets.

@mhayes
mhayes / .tmux.conf
Created October 12, 2018 19:24
tmux configuration
unbind C-b
set -g prefix C-s
unbind +
bind + new-window -d -n tmux-zoom 'clear && echo TMUX ZOOM && read' \; swap-pane -s tmux-zoom.0 \; select-window -t tmux-zoom
unbind -
bind - last-window \; swap-pane -s tmux-zoom.0 \; kill-window -t tmux-zoom
bind r source-file ~/.tmux.conf \; display "configuration file reloaded."
#set window numbering at 1
set -g base-index 1
@mhayes
mhayes / slack-sns.js
Created April 11, 2017 19:16
SNS to Slack via Lambda
const https = require("https");
const util = require("util");
const SLACK_WEBHOOK_PATH = process.env.SLACK_WEBHOOK_PATH;
const SLACK_CHANNEL = process.env.SLACK_CHANNEL;
const SLACK_USERNAME = process.env.SLACK_USERNAME || "aws";
const SLACK_EMOJI = process.env.SLACK_EMOJI || ":aws:";
function noop (ret) {
if (ret) {
@mhayes
mhayes / inheritance.js
Last active September 15, 2015 22:59
Simple javascript inheritance (as i currently understand it)
var Mammal = function (name) {
this.name = name;
};
Mammal.prototype.sayHello = function () {
return "Hello, I'm a " + this.name;
}
var Cow = function (name) {
Mammal.apply(this, arguments);
@mhayes
mhayes / README.md
Last active August 29, 2015 14:22
Need quick way to rename files according to a sequence?

quickstart

Let's assume you have OS X screenshots named like Screen Shot 2015-06-09 at 9.39.56 AM.png. You can use this script to rename them like so:

mark:screens mark$ ruby renamer.rb 
move ./Screen Shot 2015-06-09 at 9.39.56 AM.png to EXAMPLE_ONE_160x600_1.png
move ./Screen Shot 2015-06-09 at 9.39.57 AM.png to EXAMPLE_ONE_160x600_2.png
move ./Screen Shot 2015-06-09 at 9.39.58 AM.png to EXAMPLE_ONE_160x600_3.png
move ./Screen Shot 2015-06-09 at 9.40.00 AM.png to EXAMPLE_ONE_160x600_4.png
@mhayes
mhayes / index.php
Created April 8, 2015 01:07
Send an e-mail with PHP
<?php
if(isset($_POST['email'])) {
$name = trim($_POST['name']);
$email = trim($_POST['email']);
$subject = trim($_POST['subject']);
$message = trim($_POST['message']);
if (preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $email)) {
$to = "me@example.com";
$email_subject = "Contact Form Submission | $name";
@mhayes
mhayes / setup.sh
Last active August 29, 2015 14:06
Setup Foundation
#! /bin/sh
mkdir -p ~/Sites/zurb-foundation
cd ~/Sites/zurb-foundation
npm install bower grunt-cli -g
rc=$?
if [[ $rc != 0 ]] ; then
sudo npm install bower grunt-cli -g
fi
echo "[SUCCESS] Installed bower and grunt";
@mhayes
mhayes / setup.sh
Created April 29, 2014 22:51
Setup SassC + LibSass on MacOSX (tested on 10.9.2 only)
#!/bin/bash
# # Allow us to compile from source
# https://github.com/hcatlin/libsass/archive/master.zip
# https://github.com/hcatlin/sassc/archive/master.zip
TMPFILE="libsass"
PWD=`pwd`
wget "https://github.com/hcatlin/libsass/archive/master.zip" -O $TMPFILE
unzip -d $PWD $TMPFILE
@mhayes
mhayes / SassMeister-input.scss
Created February 5, 2014 19:57
Generated by SassMeister.com.
// ----
// libsass (v0.7.0)
// ----
// works in libsass, not in ruby sass
$text-direction: ltr;
$text-direction: ltr !default;
@mhayes
mhayes / SassMeister-input-HTML.html
Created January 8, 2014 01:06
Generated by SassMeister.com.
<div class="pie-timer deg-0"></div>