Skip to content

Instantly share code, notes, and snippets.

View stevenwanderski's full-sized avatar

Steven Wanderski stevenwanderski

View GitHub Profile
<?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>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.53333336114883423</real>
<key>Green Component</key>
@stevenwanderski
stevenwanderski / fresh_rails.md
Last active July 9, 2020 12:50
Fresh Rails Install

Fresh Rails Install

Follow these steps to get a fully functioning Rails app up and running complete with initial styles and authentication.

  1. Install Rails with Postgres: rails new trix -d postgresql --skip-action-cable --skip-coffee --skip-turbolinks --skip-test

  2. Create database: rake db:create

  3. Create UUID migration and run it: rails g migration enable_uuid_extension Add this line: enable_extension 'pgcrypto'

def flatten_array(input, base = [])
if !input.is_a?(Array)
raise 'When using `flatten_array`, an array must be supplied as the input.'
end
if !base.is_a?(Array)
raise 'When using `flatten_array`, an array must be supplied as the base.'
end
input.each do |element|
module.exports = {
entry: "./src/app.js",
output: {
filename: "public/bundle.js"
},
resolve: {
extensions: ['', '.js', '.jsx', '.css']
},
module: {
loaders: [
npm i --save-dev babel-core babel-loader babel-preset-es2015 babel-preset-react css-loader file-loader react-hot-loader style-loader url-loader webpack webpack-dev-server
npm i --save react react-dom
// Assuming that jQuery is available
$('#pod-container').on('pod:init', function(){
// Initialize a new slider
var slider = $('#slider').bxSlider();
// Or reload an existing slider
slider.reloadSlider();
});
@stevenwanderski
stevenwanderski / file.rb
Last active December 20, 2015 04:29
Capybara: fill in a CKEditor field
def fill_in_ckeditor(locator, opts)
browser = page.driver.browser
content = opts.fetch(:with).to_json
page.execute_script <<-SCRIPT
CKEDITOR.instances['#{locator}'].setData(#{content});
$('textarea##{locator}').text(#{content});
SCRIPT
end
@stevenwanderski
stevenwanderski / application_helper.rb
Last active December 18, 2015 20:48
Navigation helper that adds active class to current page and children
module ApplicationHelper
def nav_link(link_text, link_path, include_children = true)
if include_children
class_name = request.fullpath.start_with?(link_path) ? 'active' : ''
else
class_name = current_page?(link_path) ? 'active' : ''
end
content_tag(:li, :class => class_name) do
@stevenwanderski
stevenwanderski / gist:5756825
Created June 11, 2013 13:29
bxGalleryPlugin options
maxwidth: '', // if set, the main image will be no wider than specified value (in pixels)
maxheight: '', // if set, the main image will be no taller than specified value (in pixels)
thumbwidth: 200, // thumbnail width (in pixels)
thumbcrop: false, // if true, thumbnails will be a perfect square and some of the image will be cropped
croppercent: .35, // if thumbcrop: true, the thumbnail will be scaled to this
// percentage, then cropped to a square
thumbplacement: 'bottom', // placement of thumbnails (top, bottom, left, right)
thumbcontainer: '', // width of the thumbnail container div (in pixels)
opacity: .7, // opacity level of thumbnails
load_text: '', // if set, text will display while images are loading
@stevenwanderski
stevenwanderski / active_admin.css.scss
Created April 11, 2013 06:50
Prevent Active Admin from clobbering CKEditor CSS styles
// SASS variable overrides must be declared before loading up Active Admin's styles.
//
// To view the variables that Active Admin provides, take a look at
// `app/assets/stylesheets/active_admin/mixins/_variables.css.scss` in the
// Active Admin source.
//
// For example, to change the sidebar width:
// $sidebar-width: 242px;
// Active Admin's got SASS!