🤹♂️
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python -u | |
""" | |
Python port of PHP serialize() and unserialize() | |
by Samuel Cochran <sj26@sj26.com> | |
I couldn't find a nice, fairly efficient implementation of serialize/unserialize for Python... so I wrote one. I didn't use str().partition because I wanted Python <2.5 compatibility. | |
TODO: Performance review. There's an awful lot of string copying. >.> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stick this in lib/tasks/assets.rake or similar | |
# | |
# A bug was introduced in rails in 7f1a666d causing the whole application cache | |
# to be cleared everytime a precompile is run, but it is not neccesary and just | |
# slows down precompiling. | |
# | |
# Secondary consequences are the clearing of the whole cache, which if using | |
# the default file cache could cause an application level performance hit. | |
# | |
# This is already fixed in sprockets-rails for rails 4, but we patch here for |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TIM:TIM:TIM:TIM:TIM:TIM | |
_^___ | |
T __/ [] \ | |
TIM===__ \ | |
M \________] | |
I I | |
--------/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name slack-archive-redirect | |
// @namespace https://sj26.com/slack-archive-redirect | |
// @version 1 | |
// @description Open slack in the browser straight away | |
// @author sj26@sj26.com | |
// @match https://*.slack.com/archives/* | |
// @grant none | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# Connection lifetime for ActiveRecord | |
# | |
# Make sure that connections to the database can only live for a certain number | |
# of seconds. Once lifetime is reached, the underlying connection will be | |
# reconnected. This is enforced when checking out a connection for use from the | |
# pool. Use in combination with idle_timeout to enforce connection lifetime on | |
# idle connections as well. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
__all__ = ('corpus', 'words', 'lorem') | |
''' | |
Simple Lorem Ipsum generator for python with some probabilistic punctuation smarts. | |
The corpus is the full text of De finibus bonorum et malorum/Liber Primus from wikisource: | |
http://la.wikisource.org/wiki/De_finibus_bonorum_et_malorum/Liber_Primus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I don't know how to inject this on load yet, but pasting this in a console makes the Fastmail theme change between light and dark when macOS is toggled between light and dark. | |
window.matchMedia("(prefers-color-scheme: dark)").addListener(function(query) { | |
var theme = query.matches ? "dark" : "minimal"; | |
FastMail.theme.set("theme", theme); | |
FastMail.userPrefs.set("theme", theme); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
def initialize | |
puts "A initialized" | |
end | |
end | |
module B | |
def initialize_with_b | |
puts "B initialized" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppleRecord < Record | |
end |