Skip to content

Instantly share code, notes, and snippets.

View brew's full-sized avatar
🚀
Floating through space

Brook Elgie brew

🚀
Floating through space
View GitHub Profile
@lededje
lededje / testSetup.js
Created January 8, 2018 01:41
This is a gist that patches react-native's components and apis with jest to allow you to use Enzyme's react 16 adapter
import React from 'react';
jest.mock('react-native', () => {
const createMockComponent = (name) => {
const mockedComponent = ({ children }) => (
<div>{children}</div>
);
mockedComponent.displayName = name;
return mockedComponent;
}
@mixja
mixja / Dockerfile
Last active September 17, 2019 11:06
Docker Health Check using Make
FROM nginx
HEALTHCHECK --interval=3s --retries=20 CMD curl -fs http://localhost:${HTTP_PORT:-8000}
@Vestride
Vestride / encoding-video.md
Last active April 24, 2024 09:59
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@bobbygrace
bobbygrace / trello-css-guide.md
Last active April 22, 2024 10:15
Trello CSS Guide

Hello, visitors! If you want an updated version of this styleguide in repo form with tons of real-life examples… check out Trellisheets! https://github.com/trello/trellisheets


Trello CSS Guide

“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”

You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?

@tchn
tchn / m2crypt.py
Created May 8, 2013 13:35
A python m2crypto usage example, simply encrypt/decrypting AES-128/ECB
#!/bin/env python
# m2crypt.py <mode> <key> <data>
import M2Crypto
import binascii
import sys
mode = sys.argv[1]
key = sys.argv[2]
data = sys.argv[3]
@carljm
carljm / runner.py
Created December 9, 2011 04:07
Unittest2 test discovery and real dotted-path named test selection for Django
"""
An alternative Django ``TEST_RUNNER`` which uses unittest2 test discovery from
a base path specified in settings, rather than requiring all tests to be in
``tests`` module of an app.
If you just run ``./manage.py test``, it'll discover and run all tests
underneath the ``TEST_DISCOVERY_ROOT`` setting (a path). If you run
``./manage.py test full.dotted.path.to.test_module``, it'll run the tests in
that module (you can also pass multiple modules).
@tmcw
tmcw / disconnect.rb
Created July 22, 2011 04:06
bulk-export run data from Garmin Connect
#!/usr/bin/env ruby
## disconnect
# ./disconnect.rb -u yourusername
#
# This is a command-line utility for the bulk-downloading of run data from
# the connect.garmin.com web application, which has lackluster export
# capabilities.
#
@fwenzel
fwenzel / lion-virtualenv.sh
Created July 21, 2011 17:42
Recreating virtualenvs after upgrading to OS X Lion.
# Upgrade to OS X Lion, notice your virtualenvs are all hosed.
# Install Xcode 4.1 from the app store (or //fs2/IT/Apple/).
# Make sure to actually *run* the install, it's an app inside Applications. Throw it away afterwards, if you want the space back.
sudo easy_install pip
sudo pip install virtualenv virtualenvwrapper ipython
# blow the old one(s) away
rmvirtualenv playdoh
@puffin
puffin / MockResponse.py
Created May 11, 2011 18:18
Mock urllib2.open for UnitTest
class MockResponse(object):
def __init__(self, resp_data, code=200, msg='OK'):
self.resp_data = resp_data
self.code = code
self.msg = msg
self.headers = {'content-type': 'text/plain; charset=utf-8'}
def read(self):
return self.resp_data