Skip to content

Instantly share code, notes, and snippets.

@Shpigford
Shpigford / content.js
Created August 25, 2022 00:18
Arc Boost for blocking distracting sites
const domains = ['cnn.com'];
const content = 'Nope!';
if (domains.includes(window.location.hostname.replace('www.',''))) {
document.body.style.backgroundColor = 'red';
document.body.style.color = 'white';
document.body.style.textAlign = 'center';
document.body.style.fontWeight = 'bold';
document.body.style.fontFamily = 'sans-serif';
document.body.style.textTransform = 'uppercase';
def filtered_tracks(current_user)
tracks = current_user.tracks.limit(500)
rules = filters['rules']
if rules.find {|h| h['id'] == 'track_name'}.present?
track_name = rules.find {|h| h['id'] == 'track_name'}['value']
tracks = tracks.where('tracks.name ILIKE ?', '%' + track_name + '%')
end
class BuildAlbumSpotifyJob
include Sidekiq::Worker
sidekiq_options :queue => :default
def perform(artist_id)
artist = Artist.find artist_id
albums = RSpotify::Artist.find(artist.spotify_id).albums(limit:50, album_type: 'album,single')
albums.each do |album|
@Shpigford
Shpigford / gist:7a1d48013d2dad64873c
Created September 8, 2014 11:21
Slack Sidebar Theme
// Paste in to Preferences > Sidebar Theme
#256BAD,#256BAD,#242E35,#FFFFFF,#242E35,#FFFFFF,#6DA94A,#DECC30
class LiveController < ApplicationController
include ActionController::Live
def stream
# Set the response header to keep client open
response.headers['Content-Type'] = 'text/event-stream'
begin
100.times {
response.stream.write("The temperature is #{ 100*rand} degrees\n")
def animals
sheep.each do |horse|
# get 'em
end
cows.each do |cow|
# then get these
end
pigs.each do |pig|
# Example to initialize gridster and handle resizing
# Module grid settings
WIDGET_BASE_DIMENSIONS_X = WIDGET_DESKTOP_X = 140
WIDGET_BASE_DIMENSIONS_Y = 20
WIDGET_CONTAINER_SELECTOR = '.widget-view'
WIDGET_MOBILE_CUTOFF_WIDTH = 768
NUM_WIDGETS = 15
$ ->
@Shpigford
Shpigford / Failed Bank Import email.
Last active December 24, 2015 12:29 — forked from lessallan/Failed Bank Import email.
Not really any shorter, but definitely less dry and more human.
Subject: Action Needed: Can't import your finacial data!
Hey <first name or friend>!
We're having trouble importing your financial bits in to LessAccounting.
Seems your login details are outdated for <insert bank name>.
So, to keep your financial details spot on, we need to make sure that data gets imported.
@Shpigford
Shpigford / gist:6158106
Last active December 20, 2015 15:59
Temper email subject line to PopSurvey.com customers...
Which of these do you think would work best? Emailing this out to all our PopSurvey customers to let them know about Temper. They've never heard of Temper but the product (and "customer happiness") are something most are interested in.
* Track customer happiness with Temper, a new tool by PopSurvey
* Announcing Temper: A new tool to track customer happiness by PopSurvey
* PopSurvey launches new tool to track customer happiness!
* New from PopSurvey - Track Customer Happiness with Temper
* Increase customer satisfaction with Temper, a new tool by PopSurvey
...or something else?
@Shpigford
Shpigford / retina_icons.scss
Created July 5, 2013 14:50
Single-resource retina sprites
$icons: sprite-map("icons/*.png", $spacing: 3px);
@mixin responsive-sprite($icon) {
$iconname: "icons/#{$icon}.png";
$iconwidth: round(image-width($iconname)/2);
$iconheight: round(image-height($iconname)/2);
$pos: sprite-position($icons, $icon);
$posx: round(nth($pos, 1)/2);
$posy: round(nth($pos, 2)/2);