Skip to content

Instantly share code, notes, and snippets.

Always follow the instructions in plan.md. When I say "go", find the next unmarked test in plan.md, implement the test, then implement only enough code to make that test pass.
# ROLE AND EXPERTISE
You are a senior software engineer who follows Kent Beck's Test-Driven Development (TDD) and Tidy First principles. Your purpose is to guide development following these methodologies precisely.
# CORE DEVELOPMENT PRINCIPLES
- Always follow the TDD cycle: Red → Green → Refactor
- Write the simplest failing test first
@premek
premek / mv.sh
Last active March 5, 2024 17:43
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)
@bhrott
bhrott / AndroidCheckNotificationIsEnabled.java
Created November 16, 2016 11:54
React Native : Android : Check notification is enabled
@ReactMethod
public void areNotificationsEnabled(Promise promise) {
try {
Boolean areEnabled = NotificationManagerCompat.from(getReactApplicationContext()).areNotificationsEnabled();
promise.resolve(areEnabled);
}catch (Exception e) {
promise.reject(e);
}
}
@dstreet
dstreet / next-hoc.js
Last active August 27, 2021 08:33
Example HOC with Next.js
import React from 'react'
/*
* Higher order component that passes `getInitialProps` through
* to the child component
*/
const HOC = function(Child) {
return class Higher extends React.Component {
static getInitialProps(ctx) {
return Child.getInitialProps(ctx)
@gblmarquez
gblmarquez / .tmux.conf
Created August 6, 2015 14:28
.tmux.conf with fish as default shell
# Default termtype. If the rcfile sets $TERM, that overrides this value.
set -g default-terminal screen-256color
# support logging out and back in
set -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION"
# pbcopy support
set-option -g default-command "reattach-to-user-namespace -l bash"
# vi mode
To circle.yml:
dependencies:
post:
- bin/cisetup
checkout:
post:
- git fetch origin --depth=1000000
@claviska
claviska / vertically-centered-bootstrap-modals.js
Last active May 15, 2020 06:29
Vertically Centered Bootstrap Modals
/**
* Vertically center Bootstrap 3 modals so they aren't always stuck at the top
*/
$(function() {
function reposition() {
var modal = $(this),
dialog = modal.find('.modal-dialog');
@nsbingham
nsbingham / local-dnsserver.md
Last active June 17, 2025 14:52
Testing a CNAME

Setting up a local DNS server with bind on OSX Mavericks

This is really just an approach for locally testing DNS changes, which can easily be done with a HOSTS file if the change involves an IP address, but gets a bit trickier when things like CNAMEs are involved. This is only meant to test locally off a single machine.

  1. Install bind using homebrew

    brew install bind

  2. Follow the installation steps to start up bind

@staltz
staltz / introrx.md
Last active July 7, 2025 10:24
The introduction to Reactive Programming you've been missing
@chrisl8888
chrisl8888 / gulpfile.js
Last active January 6, 2016 05:09
Gulp + jekyll + sass + connect + livereload
var gulp = require('gulp'),
concat = require('gulp-concat'),
sass = require ('gulp-ruby-sass'),
autoprefixer = require ('gulp-autoprefixer'),
uglify = require('gulp-uglify'),
imagemin = require('gulp-imagemin'),
jekyll = require('gulp-jekyll'),
// livereload = require('gulp-livereload'),
watch = require('gulp-watch'),
jshint = require("gulp-jshint"),