Skip to content

Instantly share code, notes, and snippets.

View mateomurphy's full-sized avatar

Mateo Murphy mateomurphy

View GitHub Profile
@mateomurphy
mateomurphy / apolloScalarsLink.ts
Created March 14, 2022 21:09
Am Apollo Link for converting `ISO8601DateTime`s in graphql to `Date` objects
// Create a queue to push events and stub all methods
window.analytics || (window.analytics = {});
window.analytics_queue || (window.analytics_queue = []);
(function() {
var methods = ['identify', 'track', 'trackLink', 'trackForm', 'trackClick', 'trackSubmit', 'page', 'pageview', 'ab', 'alias', 'ready', 'group', 'on', 'once', 'off'];
var factory = function(method) {
return function () {
var args = Array.prototype.slice.call(arguments);
args.unshift(method);
@mateomurphy
mateomurphy / base.css
Last active May 28, 2018 02:23
Base css styles
:root {
--font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
--font-size: 16px;
--primary-color: #0074d9;
--primary-color-dark: #005cad;
}
* {
box-sizing: border-box;
}
import _ from 'lodash'
function deepMapKeys(obj, fn) {
if (_.isArray(obj)) {
return _.map(obj, (v) => deepMapKeys(v, fn))
}
if (_.isPlainObject(obj)) {
let newObj = {}
$ = jQuery
$.fn.extend
plugin: (options) ->
settings =
debug: true
settings = $.extend settings, options
log = (msg) ->
@mateomurphy
mateomurphy / Rakefile
Created July 8, 2011 15:24
simple mp3 prep script
task :rename do
Dir.glob('*.mp3') do |file|
new_name = file.gsub(" ", '_').gsub(/'/, '')
File.rename(file, new_name)
puts new_name
end
end
task :transcode do
Dir.glob('*.mp3') do |file|
module Dragonfly
module Endpoint
def success_headers(job)
{
"Content-Type" => job.app.resolve_mime_type(job.result),
"Content-Length" => job.size.to_s,
"Content-Disposition" => "filename=#{job.name}"
}.merge(cache_headers(job))
end
require 'net/http'
def check_response(response, expected)
raise "Unexpected response from server: #{response.code} #{response.message}" unless response.is_a?(expected)
end
def get_actual_download_url(download_url)
puts "requesting #{download_url}"
url = URI.parse(download_url)
response = Net::HTTP.start(url.host, url.port) { |http| http.get(url.path) }
namespace :bundler do
task :create_symlink, :roles => :app do
shared_dir = File.join(shared_path, 'bundled_gems')
release_dir = File.join(current_release, 'vendor', 'bundle')
run("mkdir -p #{shared_dir} && ln -s #{shared_dir} #{release_dir}")
end
task :bundle_new_release, :roles => :app do
bundler.create_symlink
run "cd #{release_path} && bundle install --deployment"
=== Epic Snow Leopard Upgrayyyyd Guide ===
Son, you’re now living in the land of 64-bit systems.
That means that some of your 32-bit shit is now broken.
Not all is lost.
== Fixing MySQL weirdness