Skip to content

Instantly share code, notes, and snippets.

View djgraham's full-sized avatar
:shipit:
Oh hello!

David Graham djgraham

:shipit:
Oh hello!
View GitHub Profile
@aeschright
aeschright / npm-strike.md
Last active September 8, 2021 16:32
A note about npm cli work status

When will npm@6.9.1 be released (and other PRs merged?)

On March 22, npm fired several members of the open source and community team for discussing workplace conditions and other labor organizing activities. As a result, core employee contributors to the npm cli were removed from the project, and others have left in solidarity or put their work on hold.

Multiple claims were filed with the NLRB on this matter. The NLRB has investigated and found sufficient evidence of validity to proceed. The National Labor Relations Act of 1935 protects US employees' right to engage in discussions of workplace concerns without threat of retaliation -- and awareness of the importance of how we treat each other is something I valued so much in collaborating with the cli team. How can we work together if we aren't free to discuss what we need?

It's disappointing for all of us to find the work we were doing interrup

@phra
phra / config.yml
Last active April 28, 2022 11:32
Update Chrome to latest version on CircleCI 2.0
- run: #STABLE
name: Install Chromedriver latest version
command: |
sudo apt-get update
sudo apt-get install lsb-release libappindicator3-1
curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome.deb
sudo sed -i 's|HERE/chrome"|HERE/chrome" --no-sandbox|g' /opt/google/chrome/google-chrome
rm google-chrome.deb
# USAGE:
# rubocop -r ./tmp/rubocop_default_args_assignment.rb --only Style/RubocopDefaultArgsAssigmment app/
#
# Finds method definitions like `def my_thing(date = date)` which are circular references in ruby 2.3.1
# Change them to `def my_thing(date = self.date)` to maintain behaviour
#
module RuboCop
module Cop
module Style
# Check if default args are circular assignments
@pboling
pboling / slim_vs_haml.md
Last active February 11, 2024 16:33
Slim vs Haml

Analysis of Slim vs. Haml Project Health

  • Static data as of April 13, 2015, some updates as of October 1, 2015
# Metric Haml Slim Winner
1 Issues Open Issues Open Issues Slim
2 Stars Stars Open Issues Slim
3 Quality Code Climate technical debt Code Climate maintainability -- Haml
4 Test Coverage ![Code Climate coverage](https://i
@Kartones
Kartones / postgres-cheatsheet.md
Last active July 23, 2024 03:57
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@sheeley
sheeley / SessionsController.rb
Last active September 13, 2021 21:30
SAML Controller for Rails (used when POSTing data to IDP and decrypting on return)
class SessionsController < ApplicationController
skip_before_filter :verify_authenticity_token, only: :saml
def new
request = Onelogin::Saml::Authrequest.new
settings = saml_settings
request_doc = request.create_authentication_xml_doc(settings)
request_str = request_doc.to_s #.force_encoding("UTF-8")
logger.debug request_str
@wrburgess
wrburgess / README.md
Last active August 31, 2017 09:53
How to add a custom calculator for shipping or taxes to Spree
  1. Add initializer to config/application.rb
  2. Add new class to app/models/spree/calculators/[class_name].rb
  3. Add logic to class file

Class must have the following methods:

def self.description
  "Custom FlexiRate"
end
@bsodmike
bsodmike / gist:1012044
Created June 7, 2011 11:12
How to find out everything you can override in a refinerycms project
cd /tmp
refinerycms bar
cd bar
git init .
git add .
git commit -a -m "Hide these files"
rake refinery:override view=**/*
rake refinery:override controller=**/*
rake refinery:override model=**/*
git add -N .
@mhenrixon
mhenrixon / _form.html.haml
Created May 18, 2011 11:02
A complete sample of how to perform nested polymorphic uploads in rails using carrierwave
=semantic_form_for [:admin, @dog], validate: true, html: {multipart: true} do |f|
=f.inputs do
=f.input :name
=f.input :kennel_name
=f.input :birthdate
=f.input :gender, as: :radio, collection: {'Tik' => 'F', 'Hane' => 'M'}
=f.input :father_id, as: :select, collection: @dogs
=f.input :mother_id, as: :select, collection: @bitches
=f.semantic_fields_for :pictures do |pic|
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby