Skip to content

Instantly share code, notes, and snippets.

View djch's full-sized avatar

Dan Charlesworth djch

  • Getbusi
View GitHub Profile
@dhh
dhh / linux-setup.sh
Last active May 4, 2024 07:05
linux-setup.sh
# CLI
sudo apt update -y
sudo apt install -y \
git curl \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev mupdf mupdf-tools \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils
@brenogazzola
brenogazzola / util_controller.js
Created October 5, 2021 15:45
Stimulus Controller
import { Controller } from 'stimulus'
export default class extends Controller {
// ============================================================================
// Public
// ============================================================================
/*
* Removes an element from the DOM
*/
@dhh
dhh / pagination_controller.js
Last active April 24, 2024 10:53
HEY's Stimulus Pagination Controller
/*
ERB template chunk from The Feed's display of emails:
<section class="postings postings--feed-style" id="postings"
data-controller="pagination" data-pagination-root-margin-value="40px">
<%= render partial: "postings/snippet", collection: @page.records, as: :posting, cached: true %>
<%= link_to(spinner_tag, url_for(page: @page.next_param),
class: "pagination-link", data: { pagination_target: "nextPageLink", preload: @page.first? }) unless @page.last? %>
</section>
@jamiemling
jamiemling / Customer Success Engineer - Tasks.md
Last active March 11, 2020 23:25
Customer Success Engineer - Tasks

These are some of the things you might do each day working in support at Raisely.

Tell us out of this list two things you are excited about, two things you want to learn how to do and two you don't want to do.

  • Responding to 20 support emails
  • Running a training webinar
  • Importing data into a new Raisely CRM account
  • Writing a new support article on how to optimise your donation form
  • Updating the developer docs to cover a new release
  • Create a video tutorial on how to set up a campaign element
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active May 3, 2024 13:01
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@javan
javan / direct-uploads.md
Last active January 29, 2023 10:58
Active Storage direct uploads

direct-uploads

rails/activestorage#81

// direct_uploads.js

addEventListener("direct-upload:initialize", event => {
  const { target, detail } = event
  const { id, file } = detail

Coding Problems

Evaluation criteria

  • Code demonstrates knowledge of Ruby syntax, style, organisation, and refactoring
  • Code is divided into logical components and methods with clear responsibility.
  • Code meets all requirements as laid out per the specification.

In one sentence: we are looking for simplicity, readability, and good practices

@benschwarz
benschwarz / pg.md
Last active December 15, 2020 04:20
Awesome postgres
@ipbastola
ipbastola / clean-up-boot-partition-ubuntu.md
Last active May 2, 2024 01:27
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@allixsenos
allixsenos / explain.py
Last active June 2, 2019 10:08
Django QuerySet Explain
from django.db import connections
from django.db.models.query import QuerySet
from __future__ import print_function
class QuerySetExplainMixin:
def explain(self, analyze=True):
cursor = connections[self.db].cursor()
print(self.query)
print()
sql, params = self.query.sql_with_params()