Skip to content

Instantly share code, notes, and snippets.

premek /
Last active Apr 17, 2021
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)
benhurott /
Created Nov 16, 2016
React Native : Android : Check notification is enabled
public void areNotificationsEnabled(Promise promise) {
try {
Boolean areEnabled = NotificationManagerCompat.from(getReactApplicationContext()).areNotificationsEnabled();
}catch (Exception e) {
dstreet / next-hoc.js
Last active Jun 12, 2021
Example HOC with Next.js
View next-hoc.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 / .tmux.conf
Created Aug 6, 2015
.tmux.conf with fish as default shell
View .tmux.conf
# Default termtype. If the rcfile sets $TERM, that overrides this value.
set -g default-terminal screen-256color
# support logging out and back in
# pbcopy support
set-option -g default-command "reattach-to-user-namespace -l bash"
# vi mode
View gist:b40e49e19b1e1c2fe042
To circle.yml:
- bin/cisetup
- git fetch origin --depth=1000000
claviska / vertically-centered-bootstrap-modals.js
Last active May 15, 2020
Vertically Centered Bootstrap Modals
View vertically-centered-bootstrap-modals.js
* 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');

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 /
Last active Jun 12, 2021
The introduction to Reactive Programming you've been missing
chrisjlee / gulpfile.js
Last active Jan 6, 2016
Gulp + jekyll + sass + connect + livereload
View gulpfile.js
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"),

A not politically correct assertion of my feelings towards a piece of software:

Note: Repetition builds cynicism, asset_sync isn't bad, but when an asset problem cannot be solved via support it gets escalated to me. Often times someone using asset_sync the problem is due to their use of the library and not from Heroku.


The asset sync gem uploads your assets (images, css, javascript) to S3. From there you can either point browsers to the copy on S3 or use a CDN + the S3 bucket. It's a good idea, and solved a problem at one time.

It is no longer needed and you should now use instead. So rather than copying your assets over to S3 after they are precompiled the CDN grabs them from your website instead. Here's some reasons why it's better.