Skip to content

Instantly share code, notes, and snippets.

@jmrnilsson
jmrnilsson / settings.json
Last active March 15, 2017 08:16
VSCode (visual studio code) user-settings.json
{
"files.trimTrailingWhitespace": true,
"files.exclude": {"**/*.pyc": true},
"editor.minimap.enabled": true,
"editor.renderWhitespace": "all",
"editor.fontFamily": "Menlo, Consolas, Fira Code",
"editor.fontLigatures": true,
"editor.fontSize": 14,
"editor.referenceInfos": false,
@jmrnilsson
jmrnilsson / patch_object.py
Created February 16, 2016 23:41
patch.object for requests.json
import requests
from nose.tools import assert_equal
from mock import Mock, patch
from brew import brewery_db as client
from utils import json_load
def response_mock():
return Mock(json=Mock(return_value=json_load('brewery_db.json')))

kind of-ish grep ready list

old

  curl https://api.github.com/gists/public | grep -B 2 '"forks_url"\|raw_url' | grep '"url"\|type' | grep -v 'user' | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/ /g' | sed -e 's/url/é/g' | tr é '\n' | sed -e 's/": "/ /g' -e 's/",         "/ /g' -e 's/ type / /g' -e 's/",     "/ /g' -e 's/",/ /g' -e 's/        "type User/ /g' -e 's/   "/ /g'

working but with cache (because rate-limiting)

  # with xargs-curl
  cat gist.json | grep -B 13 '"type": "application/x-sh"' | grep '"url": ' | sed -e 's/"url": "/ /g' -e 's/",/ /g' | head -n 1 | awk "{print $1}"

get gist

#!/bin/sh
clear
echo "HELLO WORLD"
@jmrnilsson
jmrnilsson / config.cson
Last active June 2, 2016 23:03
atom user setting (including fira code with ligatures)
"*":
editor:
fontFamily: "FiraCode-Light"
preferredLineLength: 100
tabLength: 4
".slim.text":
whitespace:
removeTrailingWhitespace: false
@jmrnilsson
jmrnilsson / gist:399c87aaa41108a566ba0dd4a82c1b5e
Created August 11, 2016 13:57
gifsicle osx screen shot cast
{
"parserOptions": {"ecmaVersion": 5},
"rules": {
"eqeqeq": 2,
"comma-dangle": 1,
"no-console": 0,
"no-debugger": 1,
"no-extra-semi": 1,
"no-extra-parens": 1,
"no-irregular-whitespace": 0,
@jmrnilsson
jmrnilsson / GrepRepositories.ps1
Last active October 27, 2016 15:51
Git grep all repositories in current directory
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,Position=1)]
[string]$expression
)
$originalPath = $pwd.Path
$repositories = gci | ?{ $_.PSIsContainer } | foreach { $_.Name }
# https://github.com/ginatrapani/todo.txt-android/wiki/Squash-All-Commits-Related-to-a-Single-Issue-into-a-Single-Commit
$ git rebase -i HEAD~4
h1. Optionally force push
But alternatively start with making a new branch
$ git push origin branch-name --force
$ git commit --amend
@jmrnilsson
jmrnilsson / Make.ps1
Last active January 29, 2017 21:43
PowerShell: Lightweight replacement function when Makefile not available
# https://github.com/PowerShell/PowerShell/blob/master/docs/installation/linux.md#macos-1011
# https://msdn.microsoft.com/powershell
# https://github.com/PowerShell/PowerShell/releases/tag/v6.0.0-alpha.15
[CmdletBinding()]
Param([Parameter(Mandatory=$False,Position=1)] [string]$Command)
$Command = If ($Command) { $Command } Else { "default" }
Write-Output "Make targets ($Command)"