Skip to content

Instantly share code, notes, and snippets.

View kengreeff's full-sized avatar

Ken Greeff kengreeff

View GitHub Profile
@dhh
dhh / linux-setup.sh
Last active November 15, 2024 19:55
linux-setup.sh
# THIS LINUX SETUP SCRIPT HAS MORPHED INTO A WHOLE PROJECT: HTTPS://OMAKUB.ORG
# PLEASE CHECKOUT THAT PROJECT INSTEAD OF THIS OUTDATED SETUP SCRIPT.
#
#
# Libraries and infrastructure
sudo apt update -y
sudo apt install -y \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
@caendekerk
caendekerk / Gemfile
Created March 4, 2021 10:48
Rails API only with Okta but without Devise
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.0'
# Shorten boot time
gem 'bootsnap'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', github: 'rails/jbuilder'
@elliott-king
elliott-king / s3_heroku_rails_01_direct_upload_controller.rb
Created August 30, 2020 14:46
Creates a URL for an Active Storage direct upload
class DirectUploadController < ApplicationController
def create
response = generate_direct_upload(blob_params)
render json: response
end
private
def blob_params
params.require(:file).permit(:filename, :byte_size, :checksum, :content_type, metadata: {})
@vochicong
vochicong / gem-rmagic-mac.sh
Created September 4, 2017 04:46
install rmagic on mac
brew install imagemagick@6
export PATH="/usr/local/opt/imagemagick@6/bin:$PATH"
export LDFLAGS=-L/usr/local/opt/imagemagick@6/lib:$LDFLAGS
export CPPFLAGS=-I/usr/local/opt/imagemagick@6/include:$CPPFLAGS
export PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig:$PKG_CONFIG_PATH
gem install rmagic
# https://stackoverflow.com/questions/10063051/bundle-cant-install-rmagick-gem-on-mac-osx-10-7
@hopsoft
hopsoft / example_job.rb
Last active September 9, 2022 06:00
Render views outside of the standard request context (i.e. ActiveJob) with Devise/Warden
class ExampleJob < ApplicationJob
queue_as :default
def perform(user)
# do some work
# HACK: get around limitations in devise/warden when rendering
# views outside the context of a formal http request
renderer = ::ApplicationController.renderer.new
renderer_env = renderer.instance_eval { @env }
@gunjanpatel
gunjanpatel / amazon-ec2-ftp.md
Last active October 10, 2023 15:31
amazon ec2 LAMP and FTP installation and setup
@DavidWells
DavidWells / reset.css
Last active November 13, 2024 09:16 — forked from karbassi/reset.css
CSS reset. Follow me on the twitters for more tips: https://twitter.com/davidwells
/* http://meyerweb.com/eric/tools/css/reset/
v2.0-modified | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
@mudge
mudge / gist:428455
Created June 7, 2010 09:29
Namespaces with Nokogiri::Builder
# Dealing with namespaces in Nokogiri.
#
# First thing you must do is abandon what you're used to with Builder,
# namespaces aren't just attributes on an element, they uniquely identify
# what sort of element you are building and, as such, you are better off
# specifying them manually.
#
# The key here is accessing the Nokogiri::XML::Element being built with
# b.parent, then you can set the namespace (distinguished by an element
# with a prefix such as "soap12:Envelope") or add a default namespace