Skip to content

Instantly share code, notes, and snippets.

View AnalyzePlatypus's full-sized avatar
🐏
Bah.

Michoel Samuels AnalyzePlatypus

🐏
Bah.
View GitHub Profile
@mike-weiner
mike-weiner / basecamp.py
Last active August 23, 2023 14:36
A Python script to make calls to the Basecamp 4 API via OAuth authentication.
import datetime
import json
import os.path
import requests
# TO DO: Enter Your BC Account ID
# Example: 999999999 from https://3.basecamp.com/999999999/
BC_ACCOUNT_ID = "<your-client-id>"
# Basecamp App Integration Information
@mlschmitt
mlschmitt / Merlin_Wisdom_Widget_Scriptable.js
Last active May 19, 2023 16:58
Random wisdom from Merlin Mann in a handy widget - https://github.com/merlinmann/wisdom
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: blue; icon-glyph: brain;
let items = await loadItems()
if (config.runsInWidget) {
let widget = await createWidget(items)
Script.setWidget(widget)
} else if (config.runsWithSiri) {
let firstItems = items.slice(0, 5)
let table = createTable(firstItems)
@merlinmann
merlinmann / wisdom.md
Last active April 17, 2024 21:52
Merlin's Wisdom Project (Draft)

Merlin's Wisdom Project

Or: “Everybody likes being given a glass of water.”

By Merlin Mann.

It's only advice for you because it had to be advice for me.

@jferris
jferris / configmap.yaml
Last active February 8, 2024 14:15
Rails Kubernetes Manifests
apiVersion: v1
kind: ConfigMap
metadata:
name: example
namespace: default
data:
APPLICATION_HOST: example.com
LANG: en_US.UTF-8
PIDFILE: /tmp/server.pid
PORT: "3000"
@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
@dteoh
dteoh / rspec_rails_set_session.md
Created May 29, 2020 07:49
Setting session variables in an RSpec Rails request spec

Setting session variables in an RSpec Rails request spec

You are writing a spec with type: :request, i.e. an integration spec instead of a controller spec. Integration specs are wrappers around Rails' ActionDispatch::IntegrationTest class. I usually write controller tests using this instead of type: :controller, mainly because it exercises more of the request and response handling stack. So instead of writing something like get :index to start the request, you would write get books_path or similar.

One of the issues with using type: :request is that you lose the ability to

@sainf
sainf / jsPDF_line_wrap.md
Last active February 18, 2020 20:41 — forked from AnalyzePlatypus/jsPDF_line_wrap.md
Helper function for line-wrapping in jsPDF
@colingourlay
colingourlay / apple-web-dynamic-type.css
Last active September 16, 2023 15:43
Support Apple's dynamic text sizing in web content (iOS Safari & WebViews)
/*
To support dynamic type in iOS, we need to set Apple's
system font and then define font-families and rem-based
font-sizes on descendant elements:
*/
@supports (font: -apple-system-body) {
html {
font: -apple-system-body;
}
}
@EvanBacon
EvanBacon / apple-touch-startup-image.html
Created April 17, 2019 07:10
An example of full iOS PWA startup image (splash screen) support.
<html>
<head>
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-touch-fullscreen" content="yes" />
<meta name="apple-mobile-web-app-title" content="Expo" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
<link
rel="apple-touch-icon"
sizes="180x180"
@joshuap
joshuap / redis.rb
Created November 30, 2018 01:31
Disable dangerous Redis commands in Ruby
# config/initializers/redis.rb
require 'redis'
# Disables the `flushdb` and `flushall` commands.
class Redis
module DangerousCommands
def flushdb
raise 'This is EXTREMELY DANGEROUS! If you really want to EMPTY THE ENTIRE DATABASE, do it from `redis-cli`.'
# You could call `super` here if you want to allow access in some circumstances.
end