Skip to content

Instantly share code, notes, and snippets.

aortbals / ocr.bash
Created Feb 19, 2020
OCR all files in a folder using Tesseract, ignoring existing files.
View ocr.bash
#! /usr/bin/env bash
### ocr
# OCR all files in a folder using Tesseract, ignoring existing files.
## Functions
usage() {
aortbals / tsconfig.json
Created Dec 6, 2018
create-react-app TypeScript configs
View tsconfig.json
"compilerOptions": {
"target": "esnext",
"allowJs": true,
"skipLibCheck": false,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
aortbals /
Last active Jan 12, 2021
Squash and Merge on the Command line

With the introduction of GitHub's Squash and Merge feature, this has become less prevelant, however it's still useful in scenarios where GitHub's interface is unavailable.

Let's talk through two ways to do a squash and merge on the command line.

Take 1: Interactive Rebase

When to use it

  • When you have not merged master into your feature branch
  • There are no merge conflicts
aortbals / csp-sha.js
Last active Apr 20, 2017
Generate a sha256-base64 string for a content security policy
View csp-sha.js
#!/usr/bin/env node
const crypto = require('crypto');
if (!process.argv[2]) {
console.log('Usage: csp-sha <string>');
aortbals / app.css
Created Apr 5, 2017
CSS Modules and Global CSS with Webpack 1.x
View app.css
This file contains non-global CSS modules
@import "css/variables";
@import "css/utilities";
:global html {
color: var(--black);
aortbals / checkStatus.js
Last active Apr 4, 2017
Check the status of a fetch response
View checkStatus.js
* Check the status of a fetch response.
export default function checkStatus(response) {
if (response.ok) {
return response;
const error = new Error(response.statusText);
error.response = response;
aortbals / Moment.js React
Last active Apr 11, 2019
React <Moment /> Component
View Moment.js React

Basic Format API

Since the usage of format is so common, there is an easy API:

<Moment date={publishedAt} format="MMMM D, YYYY" />

Advanced API

aortbals / react-component-es6.sublime-snippet
Last active Feb 9, 2016
React JSX Sublime Text Snippets
View react-component-es6.sublime-snippet
import React, { Component } from 'react';
export default class ${TM_FILENAME/(.?\w*)(?:\.\w+)*$/$1/g} extends Component {
static propTypes = {
render() {
return (
aortbals / zippable.rb
Last active Sep 24, 2015
Zip a directory in memory with ruby
View zippable.rb
require 'find'
require 'zip'
module Zippable
def to_zip
return zipped_file_path if File.exists? zipped_file_path
validate_file_exists, ::Zip::File::CREATE) do |zipfile|
if file_path
aortbals / controllers.application.js
Last active Aug 29, 2015
Array Computed Properties
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
items: [
{ name: 'Fuu' },
{ name: 'Bar' },
{ name: 'Baz' },
{ name: 'Qix' }