Skip to content

Instantly share code, notes, and snippets.

View phil-6's full-sized avatar
😃

Phil Reynolds phil-6

😃
View GitHub Profile
class PurgeOrphanedNotificationsJob < ApplicationJob
queue_as :default
def perform
Notification.find_each do |n|
n.to_notification.message
rescue
n.destroy
end
end
@nikhilmwarrier
nikhilmwarrier / webdesign-resources.md
Last active January 24, 2022 06:44
Some web design resources (as requested by u/Pazka on r/web_design)

The obvious: css-tricks.com and smashingmagazine.com

A css-tricks' curated list of animation libraries (This popped in my feed quite a while ago and I had it bookmarked)

For more curated lists: cssauthor.com (found this very recently)

AnimXYZ seems to be a great animations library if you want to get started with animations

GSAP has a bit of a learning curve, so I recommend you watch some tutorials on youtube first

@rickychilcott
rickychilcott / slim_select_helper.rb
Last active February 22, 2024 13:23
slim-select capybara helpers
## from @dinshaw in https://github.com/brianvoe/slim-select/pull/246
## Assumption is that you have a label who's parent also contains the select list you are choosing from.
def js_select(item_text, options)
container = find(:xpath, "//parent::*[label[text()='#{options[:from]}']]")
within "##{container[:id]}", visible: false do
find('.ss-arrow').click
input = find(".ss-search input").native
input.send_keys(item_text)
find('div.ss-list').click
@abelorian
abelorian / agora.rb
Last active September 22, 2023 11:35
Agora dynamic Key ruby RTC example. Gem agora_dynamic_key https://rubygems.org/gems/agora_dynamic_key
# In Gemfile: gem 'agora_dynamic_key', '~> 0.1.0'
require 'dynamic_key'
class Agora
EXPIRATION_TIME_IN_SECONDS = 3600*3
def generate_rtc_token channel_name = 'any_channel_name'
params = {
require 'nokogiri'
require 'open-uri'
# Get a Nokogiri::HTML:Document for the page we're interested in...
doc = Nokogiri::HTML(open('http://www.google.com/search?q=tenderlove'))
# Do funky things with it using Nokogiri::XML::Node methods...
####
# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
end
resource :lock
end
end
@frankyonnetti
frankyonnetti / CSS--hex-opacity-values.css
Last active December 8, 2023 05:56
#css Hex Opacity Values
/*
* Hex Opacity Values
*/
100% — FF
95% — F2
90% — E6
85% — D9
80% — CC
75% — BF