Skip to content

Instantly share code, notes, and snippets.

View macowie's full-sized avatar
💫
I will rise up with fists!!

Madeline Cowie macowie

💫
I will rise up with fists!!
View GitHub Profile
@idelem
idelem / titleUrlMarkdownClip.js
Last active November 4, 2024 22:22 — forked from bradleybossard/titleUrlMarkdownClip.js
Bookmarklet to copy current page title and url in Markdown format to clipboard, like [title](url) - Usual for posting links to resources in README.md files
javascript:(function() {
function copyToClipboard(text) {
if (window.clipboardData && window.clipboardData.setData) {
/*IE specific code path to prevent textarea being shown while dialog is visible.*/
return clipboardData.setData("Text", text);
} else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
var textarea = document.createElement("textarea");
textarea.textContent = text;
@kyraocean
kyraocean / 01-seeyouspacecowgirl.sh
Last active January 24, 2022 03:04
SEE YOU SPACE COWBOY|GIRL cosmic-colored terminal logout
#!/usr/bin/env bash
# SEE YOU SPACE COWGIRL by KYRA OCEAN (kyraocean.com) (July 2014)
# Displays a timeless message in your terminal with cosmic color effects
# Usage: add "sh ~/seeyouspacecowgirl.sh; sleep 2" to .bash_logout (or similar) in your home directory
# (adjust the sleep variable to display the message for more seconds)
# Cosmic color sequence
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active November 16, 2024 05:10
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@coreyhaines
coreyhaines / Editable.elm
Last active August 25, 2022 05:11
type Editable
module Editable exposing (..)
type Editable ofType
= NotEditing { value : ofType }
| Editing { originalValue : ofType, buffer : ofType }
value : Editable ofType -> ofType
value editable =
@seoyoochan
seoyoochan / rails http status codes
Created February 9, 2016 08:50 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@grantland
grantland / AGB-001_Light_Mod.md
Last active November 9, 2024 15:30
AGB-001 Front/Backlight Mod Instructions

AGB-001 Front/Backlight Mod Instructions

AGB-001 Backlight Mod

Requirements

  • AGB-001
  • ASS101 screen
@brianhempel
brianhempel / bench_rails_memory_usage.rb
Last active October 6, 2022 12:47
A script to test the memory usage of your Rails application over time. It will run 30 requests against the specified action and report the final RSS. Choose the URL to hit on line 45 and then run with `ruby bench_rails_memory_usage.rb`.
require "net/http"
def start_server
# Remove the X to enable the parameters for tuning.
# These are the default values as of Ruby 2.2.0.
@child = spawn(<<-EOC.split.join(" "))
XRUBY_GC_HEAP_FREE_SLOTS=4096
XRUBY_GC_HEAP_INIT_SLOTS=10000
XRUBY_GC_HEAP_GROWTH_FACTOR=1.8
XRUBY_GC_HEAP_GROWTH_MAX_SLOTS=0
@nicinabox
nicinabox / index.html
Created September 17, 2013 14:28
Image focus on CSS cropped image thumbnails
<div class="image-editable">
<img src="http://lorempixel.com/700/400" />
<a class="focus"></a>
</div>
<div class="image-display">
<img src="http://lorempixel.com/700/400" alt="">
<span class="focus"></span>
</div>
@runemadsen
runemadsen / description.markdown
Created September 26, 2011 15:23
Reverse polymorphic associations in Rails

Polymorphic Associations reversed

It's pretty easy to do polymorphic associations in Rails: A Picture can belong to either a BlogPost or an Article. But what if you need the relationship the other way around? A Picture, a Text and a Video can belong to an Article, and that article can find all media by calling @article.media

This example shows how to create an ArticleElement join model that handles the polymorphic relationship. To add fields that are common to all polymorphic models, add fields to the join model.