Skip to content

Instantly share code, notes, and snippets.

jamietre / pc-rules.erb
Last active February 16, 2024 10:51
Karabiner Elements config to map home/end keys to PC-like behavior on MacOS X
View pc-rules.erb
"title": "MacOS -> PC Shortcuts",
"rules": [
"description": "Top/bottom of document (ctrl+home/ctrl+end)",
"manipulators": [
"type": "basic",
"from": <%= from("home", ["command"], ["any"]) %>,
"to": <%= to([["up_arrow", ["left_command"]]]) %>,
everdimension / graphql-example.js
Created October 10, 2017 15:56
simplified graphql explanation
View graphql-example.js
// Say we need to display list of posts showing *only* their titles
// and name of the post author
// without graphql
const data = {
posts: null,
usersById: {},
szxp /
Last active April 11, 2023 07:06
Automatically bump Git tag versions and create a new tag
# BSD 3-Clause License
# Copyright (c) 2017, Péter Szakszon
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
fabiomaggio /
Last active October 20, 2022 08:48
Use git filter-branch to move all projects files to a subdir and rewrite all commits
  1. Clone project

  2. Checkout all branches that contain the files that should be moved

  3. Delete the remote

  4. Run the filter-branch command:

    git filter-branch --tree-filter 'mkdir -p /path/to/tmp; mv * /path/to/tmp; mkdir subdir; mv /path/to/tmp/* subdir/' --tag-name-filter cat --prune-empty -- --all
    • All files are first copied to a temporary dir and move from there to the new destination
  • Existing tags are updated

Raise Open File Limits in OS X

in OS X 10.4 to macOS sierra 10.12 and maybe higher!

Create Launcher Script:


Copy this entire code block and paste it into your terminal and push Return to create this file for you with correct permissions. It will (probably) ask for your password:

krzysu / App.js
Last active February 16, 2022 20:47
how to integrate react-select with react-dnd
View App.js
import React, { Component } from 'react';
import Select from 'react-select'
import SortableItem from './SortableItem';
import SortableContainer from './SortableContainer';
import update from 'react/lib/update';
const items = [
{ value: '1', label: 'One' },
{ value: '2', label: 'Two' },
{ value: '3', label: 'Three' },
thevangelist / my-component.spec.js
Created August 4, 2016 13:06
The only React.js component test you'll ever need (Enzyme + Chai)
View my-component.spec.js
import React from 'react';
import { shallow } from 'enzyme';
import MyComponent from '../src/my-component';
const wrapper = shallow(<MyComponent/>);
describe('(Component) MyComponent', () => {
it('renders without exploding', () => {
kristoferjoseph / .vimrc
Last active November 14, 2017 19:44
minimal vimrc file
View .vimrc
set nocompatible " be iMproved, required
set background=dark
syntax enable
filetype on " without this vim emits a zero exit status, later, because of :ft off
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
veganista / file.liquid
Created April 20, 2016 10:56
Debugging Objects in Shopify Templates
View file.liquid
<script>console.log({{ product | json }});</script>
tanyuan /
Last active February 24, 2024 06:03
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.