Community
Cheatsheets
- GenServer Cheatsheet by Benjamin Tan Wei Hao
Books
after "deploy:symlink", "deploy:restart_workers" | |
## | |
# Rake helper task. | |
# http://pastie.org/255489 | |
# http://geminstallthat.wordpress.com/2008/01/27/rake-tasks-through-capistrano/ | |
# http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano/ | |
def run_remote_rake(rake_cmd) | |
rake_args = ENV['RAKE_ARGS'].to_s.split(',') | |
cmd = "cd #{fetch(:latest_release)} && #{fetch(:rake, "rake")} RAILS_ENV=#{fetch(:rails_env, "production")} #{rake_cmd}" |
class CustomScrubber < Loofah::Scrubber | |
ALLOWED_IFRAME_ATTRS = %w[allowfullscreen frameborder height src width].freeze | |
ALLOWED_VIDEO_REGEX = %r{\A(?:https?:)?//(?:www\.)?youtube|vimeo(?:-nocookie)?\.com/} | |
def scrub(node) | |
if node.name == 'iframe' && node['src'] =~ ALLOWED_VIDEO_REGEX | |
node.attribute_nodes.each { |a| a.remove unless ALLOWED_IFRAME_ATTRS.include?(a.name) } | |
return CONTINUE | |
end | |
return CONTINUE if html5lib_sanitize(node) == CONTINUE |
require 'aws-sdk' | |
class BucketSyncService | |
attr_reader :from_bucket, :to_bucket, :logger | |
attr_accessor :debug | |
DEFAULT_ACL = "public-read" | |
def initialize(from_bucket, to_bucket) |
require 'rubygems' | |
require 'faraday' | |
require 'socksify' | |
require 'socksify/http' | |
require 'awesome_print' | |
# This is a SOCKS monkey patch for Faraday, with example use/unit test. | |
# Notes: | |
# * It is altered to work with SOCKS5 authentication. | |
# * net_http_class must return a Faraday::Adapter::NetHttp instance. |
//Here's an eye catching example to get your visitors back when your web page tab is not active within the browser (onblur). This script will animate the original title text with an intro, the original title text is restored when the tab is returned to active state (focus). When the tab is clicked the original page title is restored. For social media sharing it is highly recommended to include the original page title text with the prefaced animated text (onblur). | |
//Created by SHEmedia.us | |
$(function() { | |
var origTitle, animatedTitle, timer; | |
function animateTitle(newTitle) { | |
var currentState = false; | |
origTitle = document.title; // save original title |
/** | |
* This is ported from Rangy's selection save and restore module and has no dependencies. | |
* Copyright 2019, Tim Down | |
* Licensed under the MIT license. | |
* | |
* Documentation: https://github.com/timdown/rangy/wiki/Selection-Save-Restore-Module | |
* Use "rangeSelectionSaveRestore" instead of "rangy" | |
*/ | |
var rangeSelectionSaveRestore = (function() { | |
var markerTextChar = "\ufeff"; |
Model.where(:date_column => date) | |
Model.where('extract(year from date_column) = ?', desired_year) | |
Model.where('extract(month from date_column) = ?', desired_month) | |
Model.where('extract(day from date_column) = ?', desired_day_of_month) |
{ | |
"💍":"diamond | engagement ring | diamond ring | diamond rings | diamonds | engagement rings", | |
"🆎":"blood type AB", | |
"❣":"heart", | |
"🇱🇨":"Saint Lucia | Saint Lucian flag", | |
"🇮🇪":"Ireland | Irish flag", | |
"🇨🇮":"Côte d’Ivoire | Ivory Coast | Ivorian flag", | |
"💎":"diamond | gem | gemstone | jewel | diamonds | gems | gemstones | jewels", | |
"☠️":"skull and crossbones | poison | poisonous", | |
"👩💻":"technology worker | tech worker | technologist | techie | IT worker | Apple genius | woman in technology | woman tech worker | woman technologist | woman IT worker | woman in IT | woman Apple genius", |
Community
Cheatsheets
Books