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
(ApplicationRecord.subclasses + ActiveRecord::Base.subclasses).each do |klass| | |
next if klass.abstract_class? || klass.ignored_columns.none? | |
ignored = klass.ignored_columns | |
klass.ignored_columns = [] | |
klass.reset_column_information | |
removed = ignored - klass.column_names | |
klass.ignored_columns = ignored | |
next unless removed.any? |
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
# coding: utf-8 | |
# Skye Shaw's Ruby is the New Perl ™️ Guide to Procs and lambda and Some Random Shit | |
lambda do | |
p 1 | |
p 2 | |
p 3 | |
end[] | |
lambda { |
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 | |
# | |
# Export the metafields for products in your Shopify store to a JSONL file. | |
# Can be modified to output to a file per product or to text file(s). | |
# See Shopify Development Tools (sdt) for more infomation. | |
# | |
# By ScreenStaring (http://screenstaring.com) | |
# | |
# |
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
perl -E'print $+[1]-$l,$& and $l=$+[1] while $ARGV[0] =~ /(.)(?!\1)/g' aaabbbcdeee | |
3a3b1c1d3e | |
perl -E'print $2 x $1 while $ARGV[0] =~ /(\d+)(.)/g' 3a3b1c1d3e | |
aaabbbcdeee |
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
namespace :db do | |
namespace :structure do | |
task :dump => :environment do | |
# Can add more dump options to ~/.my.cnf: | |
# | |
# [mysqldump] | |
# skip-comments | |
# | |
command = %q{perl -i -pe's/AUTO_INCREMENT=\d+\s//' %s} % Rails.root.join("db/structure.sql") | |
sh command, :verbose => false do |ok, res| |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>A</key> | |
<key>B</key> | |
<string>sshaw</string> | |
<string>DDEX</string> | |
</dict> | |
</plist> |
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
module PropertyManagement | |
class OnBoarding | |
# | |
# ********** | |
# Setup | |
# ********** | |
# | |
# ActiveRecord: None | |
# ActiveModel+freeze: None | |
# Hash: None, but param massaging may be necessary unless everything matches ActiveRecord |
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
// https://gist.github.com/sshaw/e21c9a7c82aff15359804e90ea7042a3 | |
// Pluck truthy properties and functions from an Array of Objects | |
// | |
// var a = [ {id: 123}, {id: 0}, {id: false}, {id: function() { return 'foo' }} ] | |
// pick('id', a) returns [123, 'foo'] | |
// var f = pick('id') | |
// f(a) | |
var pick = function(property, array) { | |
var picker = function(_array) { | |
return _array.reduce(function(acc, v) { |
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
module FormFields | |
def self.included(klass) | |
klass.class_eval do | |
def self.fields(*args) | |
args.flatten! | |
attr_accessor(*args) | |
@@fields = args.map(&:to_sym) | |
end | |
end | |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Slack Message to Emoji</title> | |
<script src="slack.js"></script> | |
<style> | |
h1 { | |
text-align: center; | |
} |
NewerOlder