Skip to content

Instantly share code, notes, and snippets.

View dideler's full-sized avatar

Dennis Ideler dideler

View GitHub Profile
@paulirish
paulirish / how-to-view-source-of-chrome-extension.md
Last active April 25, 2024 04:16
How to view-source of a Chrome extension

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

@mnot
mnot / snowden-ietf93.md
Last active September 12, 2023 13:40
Transcript of Edward Snowden's comments at IETF93.
@chrismdp
chrismdp / unsplash.sh
Last active December 28, 2015 17:17
Script to grab one of the 10 more recent images from Unsplash, and tint and blur it for use as an iTerm background using Solarized Dark
#!/bin/bash
# NOTE: requires ImageMagick
# NOTE: will tint to the Solarized Dark default background scheme, as the iTerm background blend option didn't lower the contrast enough for me
# NOTE: Optimised for a 1280x800 point screen (my 13" Retina MBP)
set -e
index=$[ 1 + $[ RANDOM % 10 ]]
img=`curl https://unsplash.com/rss/ | xmllint --xpath '/rss/channel/item['$index']/image/url/text()' -`
curl "$img" > ~/unsplash-latest.jpg &&
@holman
holman / emoji_test.rb
Last active June 18, 2020 01:27
A snapshot of the tests we use internally at GitHub to help edit our blog posts before they go out to everybody. For more information, take a peek at http://zachholman.com/posts/how-github-writes-blog-posts
require_relative "test_helper"
require "open-uri"
require "net/http"
class EmojiTest < Blog::Test
def test_no_emoji
posts.each do |post|
content = File.read(post)
refute_match /:[a-zA-Z0-9_]+:/, content,
@rosiehoyem
rosiehoyem / apis
Last active August 29, 2015 14:09
API Best Practicies
#API Best Practices
##Routes
Restricting Routes
resources :zombies, only: [:index, :show]
resources :humans, except: [:destroy, :edit, :update]
##Subdomain
Keeping our API under its own subdomain allows load balancing traffic at the DNS level.
resources :zombies, constraints: { subdomain: 'api' }
resources :humans, constraints: { subdomain: 'api' }
@rikukissa
rikukissa / .gitignore
Last active December 17, 2015 17:18
Darker theme for Shout. Has a bit more eye-friendly color scheme and hides some IMO unnecessary features such as "Leave" and "Submit" buttons.
.DS_Store
#!/usr/bin/env python
# Source: http://www.codingninja.co.uk/best-programmers-quotes/
quotes = [
{
"text": "There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies.",
"author": "C.A.R. Hoare, The 1980 ACM Turing Award Lecture"
}, {
"text": "The computing scientist's main challenge is not to get confused by the complexities of his own making.",
#!/bin/bash
#
# Author: Ilia Choly <ilia.choly@gmail.com>
# Year: 2014
#
if [[ -z "$1" ]]; then
echo "usage: graph_memory.sh <pid>"
exit 1
fi
@timruffles
timruffles / dyanmic_or_di_elixir.md
Last active June 11, 2020 04:23
Approaches to dependency-injection/dynamic dispatch in elixir

In many production systems you'll want to have one module capable of talking to many potential implementations of a collaborator module (e.g a in memory cache, a redis-based cache etc). While testing it's useful to control which module the module under test is talking to.

Here are the approaches I can see. The two points that seem to divide the approaches are their tool-ability (dialyzer) and their ability to handle stateful implementations (which need a pid).

Passing modules

Modules are first class, so you can pass them in. Used in EEx, where passed module must implement a behaviour.

@dhh
dhh / test_induced_design_damage.rb
Last active June 22, 2023 06:18
This is an extraction from Jim Weirich's "Decoupling from Rails" talk, which explained how to apply the hexagonal design pattern to make every layer of your application easily unit testable (without touching the database etc). It only seeks to extract a single method, the EmployeesController#create method, to illustrate the design damage that's …
# Original Rails controller and action
class EmployeesController < ApplicationController
def create
@employee = Employee.new(employee_params)
if @employee.save
redirect_to @employee, notice: "Employee #{@employee.name} created"
else
render :new
end