Skip to content

Instantly share code, notes, and snippets.

View tmilewski's full-sized avatar
👋

Tom Milewski tmilewski

👋
View GitHub Profile
#!/bin/sh
# Licence: MIT
# Created by tomykaira, 2011-10-25
if [ $# -ne 1 ]; then
echo "Give me your new project name (only)"
exit 1
fi
@tmilewski
tmilewski / lowerword.sql
Created October 18, 2010 14:08
MySQL: Title Case
-- --------------------------------------------------------------------------------
-- Routine DDL
-- --------------------------------------------------------------------------------
DELIMITER $$
CREATE DEFINER=`root`@`localhost` FUNCTION `lowerword`( str VARCHAR(128), word VARCHAR(5) ) RETURNS varchar(128) CHARSET utf8
BEGIN
DECLARE i INT DEFAULT 1;
DECLARE loc INT;

Giphy WEBP Converter

giphy [mp4 gif url]

Install

  • Copy and run the following:
curl -o /usr/local/bin/giphy https://gist.githubusercontent.com/tmilewski/f65dd9b6bfcf5c2a39742ce1e515a481/raw/3baa4e5ecdc5d07bd3948d406360e90d8223aa90/giphy; chmod +x /usr/local/bin/giphy
#!/usr/bin/env ruby
# > TOKEN=[PERSONAL ACCESS TOKEN] ruby backup.rb
require 'octokit'
directory = './backups'
client = Octokit::Client.new(
access_token: ENV['TOKEN'],
@tmilewski
tmilewski / formstack-embed-using-postscribe.html
Created April 29, 2019 20:05 — forked from matt-bailey/formstack-embed-using-postscribe.html
Embed a Formstack form asynchronously, using Postscribe
// https://github.com/krux/postscribe
<!-- Main form wrapper, required for styling the form -->
<div class="webform">
<!-- Empty div (must have a unique ID), into which the form will be loaded -->
<div id="formstack-bridal-appointment"></div>
<script type="text/javascript">// <![CDATA[
// Only run the code below when jQuery says the document is ready
(function($) {
// Process the form using postscribe:
// 1. Must reference the unique ID of the div above
@tmilewski
tmilewski / alias.symlink
Created March 11, 2020 18:32
New git aliases
@tmilewski
tmilewski / jquery.getScript.js
Created March 31, 2011 15:23
Replace the normal jQuery getScript function with one that supports debugging and which references the script files as external resources rather than inline. Helps with debugging in IE.
// Helps with IE debugging.
jQuery.extend({
getScript: function(url, callback) {
var head = document.getElementsByTagName("head")[0];
var script = document.createElement("script");
var done = false; // Handle Script loading
script.src = url;
script.onload = script.onreadystatechange = function() { // Attach handlers for all browsers
if ( !done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete") ) {
@tmilewski
tmilewski / 0-usage.ts
Created March 8, 2023 18:09
Quick and dirty pseudo-code for a typed search (Algolia) index
import { SearchIndex } from './search-index.ts'
import { SearchService } from './search-service.ts'
// ==========================================================
// Index Contents Shape
// ==========================================================
export interface Collab {
id: string
name: string