Skip to content

Instantly share code, notes, and snippets.

@wsmelton
wsmelton / docker-compose.yml
Created March 27, 2019 01:33
Docker compose file to build two containers for SQL Server 2017 (latest image)
View docker-compose.yml
version: '3.7'
services:
dba1:
container_name: 'dba1'
image:
mcr.microsoft.com/mssql/server:2017-latest
environment:
- ACCEPT_EULA=Y
@jamietre
jamietre / pc-rules.erb
Last active May 16, 2023 13:43
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
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: {},
};
get('/api/posts')
@szxp
szxp / release.sh
Last active April 11, 2023 07:06
Automatically bump Git tag versions and create a new tag
View release.sh
#!/bin/sh
# 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
fabiomaggio / git-filter-branch-move-files.md
Last active October 20, 2022 08:48
Use git filter-branch to move all projects files to a subdir and rewrite all commits
View git-filter-branch-move-files.md
  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
View ulimit.md

Raise Open File Limits in OS X

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

Create Launcher Script:

/Library/LaunchDaemons/limit.maxfiles.plist

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
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
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', () => {
expect(wrapper).to.have.length(1);
});
@kristoferjoseph
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
veganista / file.liquid
Created April 20, 2016 10:56
Debugging Objects in Shopify Templates
View file.liquid
<script>console.log({{ product | json }});</script>