Skip to content

Instantly share code, notes, and snippets.

@ks2211
ks2211 / Phoenix esbuild with Tailwind and Fontawesome
Last active January 31, 2024 05:08
Phoenix with esbuild, fortawesome, and tailwindcss
Phoenix esbuild with Tailwind+Fontawesome
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@sb8244
sb8244 / caching.ex
Last active May 23, 2024 07:29
Local/Distributed Caching
defmodule MyApp.AccountLookup.Cache do
@moduledoc """
Provides a cache that can be used for account lookups. This cache is backed by
Cachex for local storage and pg2 for remote distribution. Keys are set to expire
after 7-10 days (randomly distributed) in order to prevent stale data in our cache
over a long time period.
"""
use Cachex.DistributedCache
@athityakumar
athityakumar / powerlevel9k.config
Created July 6, 2017 18:38
Powerlevel9k oh-my-zsh theme configuration for screenshots used in https://github.com/athityakumar/colorls
export ZSH=$HOME/.oh-my-zsh
export DEFAULT_USER='athityakumar'
TERM=xterm-256color
ZSH_THEME="powerlevel9k/powerlevel9k"
POWERLEVEL9K_MODE='awesome-fontconfig'
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
POWERLEVEL9K_RPROMPT_ON_NEWLINE=true
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
$(document).ready(function(){
// Apparently I am not smart enough to figure out how to
// set the selected value on the new date_select form helper in Rails 4
// So, I had to create a client side solution
var url = document.location.href.split("?")[1];
// If the url does not have a query string
// Nothing else matters
if(url) {
var params = url.split("&");
@jcowhigjr
jcowhigjr / kick.sh
Created January 23, 2014 19:11 — forked from sosiouxme/kick.sh
#!/bin/sh
# This is a sample script for kickstarting a VM according to the openshift.ks script under virt-manager, qemu+KVM, and Linux.
# You certainly need to modify at least the CMDLINE and --location below for it to be useful (unless you work at Red Hat).
set -e
if [ $# -lt 1 ]
then
printf 'Usage: %s vm_name [arg1 [arg2 [...]]]\n' "$0"

Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.

TL;DR Demo

# Ensure system is in ship-shape.

aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev

@anotheruiguy
anotheruiguy / web-fonts-asset-pipeline.md
Last active June 24, 2024 22:11
Custom Web Fonts and the Rails Asset Pipeline

Web fonts are pretty much all the rage. Using a CDN for font libraries, like TypeKit or Google Fonts, will be a great solution for many projects. For others, this is not an option. Especially when you are creating a custom icon library for your project.

Rails and the asset pipeline are great tools, but Rails has yet to get caught up in the custom web font craze.

As with all things Rails, there is more then one way to skin this cat. There is the recommended way, and then there are the other ways.

The recommended way

Here I will show how to update your Rails project so that you can use the asset pipeline appropriately and resource your files using the common Rails convention.

@cmcculloh
cmcculloh / app.js
Last active May 11, 2021 19:25
Proxying a request through node from front end to different server
//public/javascripts/app/app.js
define(function (require) {
//require dependancies
var Marionette = require('backbone.marionette');
var Backbone = require('backbone');
var $ = require('jquery');
// Override renderer to use pre-compiled templates
Marionette.Renderer.render = function render(template, data) {
@smerrill
smerrill / openshift-origin-instructions.md
Last active December 18, 2015 13:39
Instructions on how you can get your own OpenShift Origin machine running on RHEL/CentOS 6 to closely match OpenShift Origin for cartridge development.

This document describes installing an OpenShift Origin server on RHEL/CentOS 6.4.

It uses named (because the Avahi support does not work on RHEL 6 yet) and assumes a domain name of "broker.openshiftorigin" and a domain of "openshiftorigin"

First, kickstart a machine using the kickstart below.

Next, log into the machine as root:openshift and do the following to get it provisioned:

  • cd /etc/puppet
  • Create the site.pp file, grabbing the DNSSEC key