Skip to content

Instantly share code, notes, and snippets.

View metaskills's full-sized avatar
🐙
Being Inkcellent to Each Other

Ken Collins metaskills

🐙
Being Inkcellent to Each Other
View GitHub Profile
@kalimar
kalimar / iterm2Badges.md
Last active June 30, 2022 13:27
How to add a badge to iterm2 on Zsh

Custom Badges in iTerm2

iTerm2 - the popular terminal emulator for OSX has added some really neat features. One of those, is badges. From the documentation: A badge is a large text label that appears in the top right of a terminal session to provide dynamic status, such as the current host name or git branch.

I had some trouble figuring out how to build a badge so I wanted to share a quick walk-through. Thanks to Chris Mar for teaching me.

Install shell integrations on iTerm.

Easy enough - it's an option on the dropdown menu

@adamlogic
adamlogic / compass_and_css_sprites.md
Created September 1, 2012 15:26
Compass and CSS Sprites, Explained

Compass and CSS Sprites, Explained

Last week I attempted to use the CSS sprites feature of Compass for the second or third time. It's been a struggle each time, but the power and potential is there, so I keep coming back. This time was a bit different, though, because I finally decided to stop relying on the docs and dive into the code.

Before I go into the nitty-gritty, let's take a step back and talk about why I

@dhh
dhh / comments_channel.rb
Last active December 16, 2020 14:24
On-boarding a specialized broadcast method in the channel itself
# Channel
class CommentsChannel < ApplicationCable::Channel
def self.broadcast_comment(comment)
broadcast_to comment.message, comment: CommentsController.render(
partial: 'comments/comment', locals: { comment: comment }
)
end
def follow(data)
stop_all_streams
/*!
* jQuery Tiny Pub/Sub - v0.X - 11/18/2010
* http://benalman.com/
*
* Original Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*
* Made awesome by Rick Waldron
*
@sstephenson
sstephenson / gist:1143900
Created August 13, 2011 14:20
Using multiple versions of Rails without gemsets
# RubyGems has this functionality built-in. Just specify
# the particular version you want to use as the first argument
# of the command, surrounded by underscores.
$ gem install rails --version 3.0.9
...
$ gem install rails --pre
...
$ rbenv rehash
$ rails --version
@mperham
mperham / after.rb
Created July 4, 2012 19:30
Thread-friendly shared connection
class ActiveRecord::Base
mattr_accessor :shared_connection
@@shared_connection = nil
def self.connection
@@shared_connection || ConnectionPool::Wrapper.new(:size => 1) { retrieve_connection }
end
end
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
@jeffrafter
jeffrafter / gist:1328625
Last active December 26, 2018 12:54
Local nginx proxy to rails s
worker_processes 1;
error_log /usr/local/var/log/nginx.error.log;
events {
worker_connections 1024;
}
http {
include mime.types;
@lukeredpath
lukeredpath / process_last_months_finance_reports.rb
Created November 15, 2010 13:28
Loop through each finance report and run it using my process_finance_report script, creating an invoice in FreeAgent.
#!/usr/bin/env ruby
SECONDS_IN_DAY = (24*60*60)
REPORT_ROOT = File.expand_path("~/Documents/Business/Accounts/iTunes Finance Reports")
# I group US and WW on the same invoice as they are both in USD
INVOICE_GROUPS = [%w{AU}, %w{CA}, %w{GB}, %w{EU}, %w{US WW}, %w{JP}]
one_month_ago = Time.now - (30 * SECONDS_IN_DAY)
# My "fetch_finance_reports" script puts reports in a sub-dir e.g. 2010-09-Aug
@metaskills
metaskills / lp.js
Last active January 17, 2018 19:27
LivePerson/Engage Turbolinks Hacking
// Assuming you put the LP init code into a function called window.lpTagCustomInit
document.addEventListener('turbolinks:before-cache', function(){
jQuery("[id^='LP_DIV']").empty();
})
document.addEventListener('turbolinks:load', function(){
delete window.liveperson;
delete window.lpMTagConfig;
delete window.lpTag;
@maccman
maccman / jquery.ajax.queue.coffee
Last active January 13, 2018 12:03
Queueing jQuery Ajax requests. Usage $.ajax({queue: true})
$ = jQuery
queues = {}
running = false
queue = (name) ->
name = 'default' if name is true
queues[name] or= []
next = (name) ->