Skip to content

Instantly share code, notes, and snippets.

View runningdemo's full-sized avatar
🏠
Working from home

Demo runningdemo

🏠
Working from home
View GitHub Profile
#!/bin/bash
set -e
CONTENTS=$(tesseract -c language_model_penalty_non_dict_word=0.8 --tessdata-dir /usr/local/share/tessdata/ "$1" stdout -l eng | xml esc)
hex=$((cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@jorilallo
jorilallo / Flex.js
Created August 17, 2017 20:06
Flexbox component for React
// @flow
import React from 'react';
import styled from 'styled-components';
type GlobalCssValues = 'initial' | 'inherit' | 'unset';
type WrapValue = 'nowrap' | 'wrap' | 'wrap-reverse' | GlobalCssValues;
type JustifyValue =
| 'center'
@tijme
tijme / UITextViewPlaceholder.swift
Last active May 31, 2024 11:05
The correct way to implement a placeholder in a UITextView (Swift)
//
// UITextViewPlaceholder.swift
// TextViewPlaceholder
//
// Copyright (c) 2017 Tijme Gommers <tijme@finnwea.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@nverinaud
nverinaud / dev_learning_manifesto.md
Last active March 17, 2017 12:07
The Software Developer Learning Manifesto

The Software Developer Learning Manifesto

  • Learning programming fundamentals over learning technologies and frameworks
  • Building stuff with new knowledge over learning passively by only reading, listening or watching

That is, while there is value in the items on the right, we value the items on the left more.

Manifeste D'Apprentissage pour Développeur de logiciels

@tanyuan
tanyuan / smart-caps-lock.md
Last active June 18, 2024 19:36
Smart Caps Lock: Remap Caps Lock to Control AND Escape

Smart Caps Lock: Remap to Control AND Escape (Linux, Mac, Windows)

Caps Lock 變成智慧的 Control 以及 Escape

  • 單獨輕按一下就是 Escape
  • 若按下時同時按著其他鍵,就會是 Control

這應該是 Vim 和 Emacs 的最佳解了!(Emacs? Bash 的快捷鍵就是 Emacs 系列的)

  • Send Escape if you tap Caps Lock alone.
@Jamesits
Jamesits / Qujing Cached PAC 20150711.js
Last active March 17, 2017 12:10
PAC script downloaded at Jul 11, 2015 5:04:17 PM
dnsDomainIs = function (h, d) {
return h.indexOf(d, h.length - d.length) !== -1 && (d.length === h.length || h.indexOf("." + d, h.length - ("." + d).length) !== -1)
}
function FindProxyForURL(u, h) {
h = h.toLowerCase();
if (h === "appdownload.itunes.apple.com" || dnsDomainIs(h, "battlenet.com.cn") || dnsDomainIs(h, "dist.blizzard.com.edgesuite.net") || /us-ore-\d+\.s3\.amazonaws\.com/.test(h) || /\w{2}-\w{3}-\d{5}\.s3\.amazonaws\.com/.test(h)) {
return "DIRECT"
}
a = []; // user ignore list
@will-hart
will-hart / build.py
Last active January 26, 2023 12:35
Super Simple Static Site Generator (Python)
"""
Free to use under the MIT license
Builds a static site from a list of Markdown source files. The source
files should have the same directory structure as the desired output.
Files are rendered using Markdown2 and can declare metadata variables:
---
@branneman
branneman / better-nodejs-require-paths.md
Last active June 12, 2024 02:40
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@dciccale
dciccale / git_branch.sh
Created May 11, 2013 18:02
Bash script to get the current git branch and last commit
#!/usr/bin/env bash
# checks if branch has something pending
function parse_git_dirty() {
git diff --quiet --ignore-submodules HEAD 2>/dev/null; [ $? -eq 1 ] && echo "*"
}
# gets the current git branch
function parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"
@nibblebot
nibblebot / multiwatch.js
Created December 5, 2012 17:35
Handlebars and Coffeescript Watcher
function addSlashes( str ) {
return (str+'').replace(/([\\"'])/g, "\\$1").replace(/\0/g, "\\0");
}
var spawn = require('child_process').spawn;
var growl = require('growl');
var coffee = './node_modules/.bin/coffee';
var coffee_tasks = [];
var handlebars_tasks = [];
coffee_tasks.push(spawn(coffee, ['-cwo', 'static/js', 'static/coffee']));
coffee_tasks.push(spawn(coffee, ['-cwo', 'test', 'test/src']));