Skip to content

Instantly share code, notes, and snippets.

@cec
cec / solr_deploy_interactions.rb
Created May 3, 2013 10:01
Capistrano Tasks to setup and interact with SolR and SunSpot
namespace :deploy do
# Ask whether to reindex before restarting Passenger
task :restart, :roles => :app, :except => {:no_release => true} do
solr.reindex if 'y' == Capistrano::CLI.ui.ask("\n\n Should I reindex all models? (anything but y will cancel)")
run "touch #{File.join(current_path, 'tmp', 'restart.txt')}"
end
desc 'create shared data and pid dirs for Solr'
task :setup_solr_shared_dirs do
# conf dir is not shared as different versions need different configs

Google Apps Script Document Utilities

  • getAllLinks.js

  • getAllLinks(element) - returns array of all UrlLinks in Document

  • findAndReplaceLinks(searchPattern,replacement) - changes all matching links in Document

  • changeCase.js - Document add-in, provides case-change operations in the add-in Menu.

  • onOpen - installs "Change Case" menu

  • _changeCase - worker function to locate selected text and change text case. Case conversion is managed via callback to a function that accepts a string as a parameter and returns the converted string.

  • helper functions for five cases

@jaymiejones86
jaymiejones86 / rails_website_launch_checklist.md
Last active January 18, 2021 17:51
Rails Website Launch Checklist

Ruby on Rails Website Launch Checklist

Copy this gist and customise it to your liking.

  • Run Brakeman and resolve any issues where required
  • Run rails best practices and resolve any warnings
  • Run full test suite and make sure all tests are passing
  • Make sure no dummy email addresses are left in any notification emails (eg contact form)
  • Make sure production assets compile correct (eg files in vendor, etc, compile and are not 404'ing in production environment)
  • If using unicorn in production, make sure deploys are restarting the unicorns
@g8d3
g8d3 / install.sh
Last active August 14, 2016 21:29
Script to open tabs in Ubuntu terminal using xdotool.
curl -L https://goo.gl/0Jxf8j -o /usr/local/bin/ntab
chmod +x /usr/local/bin/ntab
@caridy
caridy / export-syntax.js
Last active January 15, 2022 14:22
ES6 Module Syntax Table
// default exports
export default 42;
export default {};
export default [];
export default foo;
export default function () {}
export default class {}
export default function foo () {}
export default class foo {}
@tvlooy
tvlooy / unit.sh
Last active February 4, 2024 04:20
Bash test: get the directory of a script
#!/bin/bash
function test {
MESSAGE=$1
RECEIVED=$2
EXPECTED=$3
if [ "$RECEIVED" = "$EXPECTED" ]; then
echo -e "\033[32m✔︎ Tested $MESSAGE"
else
@maxivak
maxivak / 00.md
Last active May 6, 2024 15:27
Sending emails with ActionMailer and Sidekiq

Sending emails with ActionMailer and Sidekiq

Send email asynchroniously using Sidekiq.

ActionMailer

Create your mailer us usual: