Skip to content

Instantly share code, notes, and snippets.

Tom Milewski tmilewski

Block or report user

Report or block tmilewski

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tmilewski
tmilewski / formstack-embed-using-postscribe.html
Created Apr 29, 2019 — forked from matt-bailey/formstack-embed-using-postscribe.html
Embed a Formstack form asynchronously, using Postscribe
View formstack-embed-using-postscribe.html
// 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
View gist:a42a78ee38691da21d3cd6efe5db473b
#!/usr/bin/env ruby
# > TOKEN=[PERSONAL ACCESS TOKEN] ruby backup.rb
require 'octokit'
directory = './backups'
client = Octokit::Client.new(
access_token: ENV['TOKEN'],
View README.md

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
@tmilewski
tmilewski / jquery.getScript.js
Created Mar 31, 2011
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.
View jquery.getScript.js
// 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") ) {
View lowerword.sql
-- --------------------------------------------------------------------------------
-- 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;
View clockwork-init.sh
#!/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
View gist:4075538
var sendParam = function(p) {
// sends a GET request, no jQuery or wrapper needed
(new Image).src = '/my_route?p='+encodeURIComponent(p);
}
@tmilewski
tmilewski / countdown.coffee
Created Oct 24, 2012
A Very Simple - Timezone Agnostic - Countdown Script.
View countdown.coffee
class window.Countdown
constructor: (ends_at, custom_callbacks) ->
now = new Date
end = new Date(Number(ends_at) * 1000)
default_callbacks =
tick: ->
complete: ->
@callbacks = $.extend(default_callbacks, custom_callbacks)
@tmilewski
tmilewski / gist:3933235
Created Oct 22, 2012 — forked from wesgarrison/gist:3921560
October 19 2012 - rubygems.org - notes on server
View gist:3933235

[transcript from http://www.youtube.com/watch?v=z73uiWKdJhw and irc]

Why is the server unhappy?

  • Bundle API is 70%-80% of traffic and it has to resolve the dependency graph and Marshal
  • x Processes are spinning in Ruby with 380% (of 400% total CPU [4 x 100%])
  • x Bundle can only use vanilla gems, so that's why we have to use Marshal
  • Redis Heapsize
  • Diskspace

Timing - middle of the day US

@tmilewski
tmilewski / README.txt
Created Sep 10, 2012
Accessing Twitter Accounts in iOS5+ via RubyMotion
View README.txt
GOTCHAS:
Adding a Twitter account via the iOS5 simulator does not seem to work. Therefore, you'll need to upgrade to the iOS 6.0 Beta.
cd /Library/RubyMotion/data/6.0
rake update --trace
sudo xcode-select -switch /Applications/Xcode45-DP4.app/Contents/Developer/
PLEASE NOTE:
You can’t perform that action at this time.