Skip to content

Instantly share code, notes, and snippets.

View rickychilcott's full-sized avatar

Ricky Chilcott rickychilcott

View GitHub Profile
@julianrubisch
julianrubisch / 01-board.rb
Last active May 6, 2022 09:50
StimulusReflex Patterns - 1 Forms
# app/models/board.rb
class Board < ApplicationRecord
has_many :embeds
end
@jaredcwhite
jaredcwhite / README.md
Last active April 21, 2024 14:28
Use Shoelace Form Components with Hotwire Turbo

This is a Stimulus controller which will allow a Shoelace Form component to be processed and submitted by Turbo.

Just wrap your <sl-form> control with a form tag:

<%= form_with url: "/test-submit" do %>
  <sl-form data-controller="shoelace-form">
    controls go here
  </sl-form>
&lt;% end %&gt;
@andyyou
andyyou / rails_webpacker_bootstrap_expose_jquery.md
Last active August 9, 2022 07:38
Rails 5.2 with webpacker, bootstrap, stimulus starter

Rails 5.2 with webpacker, bootstrap, stimulus starter

This gist will collects all issues we solved with Rails 5.2 and Webpacker

Create Project

# Last few parameters(--skip-* part) is only my habbit not actully required
$ rails new <project_name> --webpack=stimulus --database=postgresql --skip-coffee --skip-test
@dpboard
dpboard / 1-SOXAGC.md
Last active November 16, 2023 08:47
Building an 'Automatic Gain Control' with SoX

Building an 'Automatic Gain Control' with SoX

SoX is a great tool for converting and processing audio. As an engineer working at a radio station I find it especially useful for processing audio files so the volume is even and smooth throughout. A recent use case was preparing news bulletins recorded by a non-technical journalist so they sounded clear and loud for an Amazon Alexa skill.

What is an AGC?

Automatic Gain Control (AGC) is an audio processing technique that is designed to smooth out volume differences between different parts of an audio programme. The majority of radio stations will have a device at their transmitter (for example, an Optimod) that does just that. Parts of the broadcast that are two quiet are boosted and parts that are too loud are atenuated.

For those familiar with audio [compressors

@bettysteger
bettysteger / trix_editor.css
Last active April 10, 2020 07:23
Trix Editor Toolbar Icons with FontAwesome
trix-toolbar .button_group button::before {
background-image: none !important;
font-family: 'FontAwesome';
font-size: 12px;
line-height: 28px;
}
trix-toolbar .button_group button.bold:before {
content: '\f032';
}
@rickychilcott
rickychilcott / gist:9209912
Last active May 17, 2016 13:07
ARD Kickstart Resources
# Don't allow observe/control
/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -users mdiaguest -access -on -privs -ControlObserve -ShowObserve -OpenQuitApps -RestartShutDown -SendFiles
/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -restart -agent
# Require permission to observe/control
/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -specifiedUsers
/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -users sccadmin -privs -all
# Allow everything
/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -users sccadmin -access -on -privs -ALL
@rickychilcott
rickychilcott / gist:6104913
Last active May 5, 2017 00:15
Remove outdated users
#!/bin/bash
# List of users to keep
KEEP=$( cat <<EOL
/Users/admin
/Users/administrator
/Users/sccadmin
/Users/scclab
/Users/Shared
/Users/Search
@timsutton
timsutton / make_spss_pkg.sh
Created May 3, 2013 16:00
repackaging script for SPSS 21 using FPM
#!/bin/sh
# Create a package for SPSS's silent installer using FPM. We do this because the "silent"
# installer requires a user to be logged in so that the Java installer will run. It
# has only been tested with version 21. FPM is just a convenience here - substituting
# pkgbuild will work if you create a pkg root structure yourself.
#
# It requires one argument, the path to the .bin silent installer.
#
# Configure VERSION, ID_PREFIX, INSTALL_DIR to your liking. We set INSTALL_DIR to its
@jrochkind
jrochkind / Explanation.md
Created October 15, 2012 17:19
Truncating html with nokogiri, with/without Rails

Rails has a handy truncate helper (which is actually mostly a method added to String ), but it warns you it's not safe to use on html source, it'll cut off end tags and such.

What if you want an HTML safe one? There are a variety of suggested solutions you can google, none of which were quite robust/powerful enough for me.

So I started with my favorite, by Andrea Singh, using nokogiri.

But:

  • I modified it to not monkey-patch Nokogiri, but be a static method instead (sadly making already confusing code yet more confusing, but I didn't want to monkey patch nokogiri)