gem install therubyracer -v '0.12.3' -- --with-v8-dir=/usr/local/opt/v8@3.15 --with-cxx=/usr/bin/gcc
From: https://stackoverflow.com/a/55162900/2089076
gem install libxml-ruby -v '3.1.0' -- --with-xml2-include=`xcrun --show-sdk-path`/usr/include/libxml2
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
var checkAutocompleteInput = function() { | |
if ($('#autocomplete').find('.tt-selectable').length === 0) { // "#autocomplete" is the autocomplete input menu section | |
$('.actions input').attr('disabled', 'disabled') // ".actions input" is the Submit button for the form | |
} else { | |
$('.actions input').removeAttr('disabled') | |
} | |
}; | |
$('#autocomplete .typeahead').typeahead({...}, {...}).on('typeahead:render', function(e) { | |
$('#autocomplete').parent().find('.tt-selectable:first').addClass('tt-cursor'); |
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 = site to check | |
while true | |
do | |
curl -L "$1" -o site1.html &>/dev/null | |
curl -L "$1" -o site2.html &>/dev/null | |
if diff -q site1.html site2.html &>/dev/null; then | |
echo "YES!!!" |
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
# list of people to secret santa | |
names = ['Foo', 'Bar', 'John', 'Jim'] | |
raise 'not even!' if names.count % 2 != 0 | |
def assigned?(matches, person) | |
matched_people = matches.values | |
matched_people.include? person | |
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
# this method is used to create a full XML structure for the Freshbooks API | |
# don't expect it to work for anything else | |
def to_xml(data_hash) | |
req_method = data_hash.delete(:method) | |
'<?xml version="1.0" encoding="utf-8"?>' + | |
"<request method=\"#{req_method}\">" + | |
hash_to_raw_xml(data_hash) + | |
'</request>' | |
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 | |
require 'optparse' | |
require 'fileutils' | |
DB_CONFIG=<<EOF | |
default: &default | |
hostname: localhost | |
adapter: postgresql | |
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 bash | |
write() { | |
command="$@" | |
# run the command | |
$@ | |
# special command exec stuff | |
case $command in |
NewerOlder