This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby '2.7.1' | |
gem 'rails', github: 'rails/rails' | |
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data | |
# Action Text | |
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra' | |
gem 'okra', github: 'basecamp/okra' | |
# Drivers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: ./set-access-points.sh [network SSID] [network interface id = wlan0] | |
# Read in the arguements | |
ssid=$1; | |
interface=$2; | |
# SSID is required | |
if [ -z "$ssid" ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sidekiq/api' | |
# BulkReindexer | |
module BulkReindexer | |
def self.reindex_model(model, promote_and_clean = true) | |
puts "Reindexing #{model.name}..." | |
index = model.reindex(async: true, refresh_interval: '30s') | |
puts "All jobs are in queue. Index name: #{index[:index_name]}" | |
loop do | |
# Check the size of queue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[1] (pry) main: 0> add = -> (a, b) { a + b } | |
=> #<Proc:0x007ffde11d72c0@(pry):1 (lambda)> | |
# Call proc with two arguments | |
[2] (pry) main: 0> add.(1, 2) | |
=> 3 | |
# Call proc with one argument | |
[3] (pry) main: 0> add.(1) | |
ArgumentError: wrong number of arguments (1 for 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActivityFinder | |
attr_reader :activities, :user | |
def initialize(user) | |
@user = user | |
@activities = Activity.all.where(:user_id => user_ids). | |
with_subject.with_user.desc | |
activities.group_by(&:subject_type).each do |name, group| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$enable_tracing = false | |
#$trace_out = File.open(Rails.root + 'trace.txt', 'w') | |
set_trace_func proc { |event, file, line, id, binding, classname| | |
if $enable_tracing && event == 'call' | |
#$trace_out.puts "#{file}:#{line} #{classname}##{id}" | |
raise "crash me" if caller_locations.length > 500 | |
end | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# List all keys stored in memcache. | |
# Forked from bkimble's gist https://gist.github.com/bkimble/1365005 | |
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place. | |
# Currently resides at https://gist.github.com/ginjo/aaa4a4395fcdbbad3d29 | |
# | |
# This fork separates the server query code from results presentation. | |
# The primary function of this script is to return an array of hashes of | |
# key items from any number of provided memcached servers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# A sneaky wrapper around Rubocop that allows you to run it only against | |
# the recent changes, as opposed to the whole project. It lets you | |
# enforce the style guide for new/modified code only, as opposed to | |
# having to restyle everything or adding cops incrementally. It relies | |
# on git to figure out which files to check. | |
# | |
# Here are some options you can pass in addition to the ones in rubocop: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$elementSeparator: '__'; | |
$modifierSeparator: '--'; | |
@function containsModifier($selector) { | |
$selector: selectorToString($selector); | |
@if str-index($selector, $modifierSeparator) { | |
@return true; | |
} @else { | |
@return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# @author Adriano Rosa (http://adrianorosa.com) | |
# @date: 2014-05-13 09:43 | |
# | |
# Bash Script to create a new self-signed SSL Certificate | |
# At the end of creating a new Certificate this script will output a few lines | |
# to be copied and placed into NGINX site conf | |
# | |
# USAGE: this command will ask for the certificate name and number in days it will expire |
NewerOlder