Skip to content

Instantly share code, notes, and snippets.

@andyperlitch
andyperlitch / mui-component.code-snippets
Created July 15, 2021 00:25
MUI Component snippet
{
"MUI Component": {
"scope": "typescriptreact",
"prefix": "muicomp",
"body": [
"import { makeStyles \\} from '@material-ui/core/styles'",
"",
"const useStyles = makeStyles({",
" root: {}",
"}, { name: '${10:ComponentName}' })",
@andyperlitch
andyperlitch / .prettierrc
Created September 12, 2019 04:52
Blandy's prettier config
{
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"semi": false,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"jsxBracketSameLine": true,
"arrowParens": "always",
{"contents":{"launch":{"version":"0.2.0","configurations":[{"type":"node","request":"attach","name":"Launch Program","outFiles":["${workspaceFolder}/**/*.js"]}]}},"overrides":[],"keys":["launch.version","launch.configurations"]}
@andyperlitch
andyperlitch / .gitconfig
Last active March 16, 2021 19:42
git config
[user]
name = [NAME]
email = [EMAIL]
[merge]
tool = opendiff
[alias]
s = status
st = status
ts = status
ci = commit
@andyperlitch
andyperlitch / go_to_ref.py
Created January 25, 2016 18:30
Simple plugin for sublime to go to a file specified by a file
import sublime, sublime_plugin
class GoToRefCommand(sublime_plugin.TextCommand):
def run(self, edit):
pos = self.view.sel()[0].begin()
region = self.view.extract_scope(pos)
ref = self.view.substr(region).replace("'", "")
folder = self.view.window().folders()[0]
print("Going to ref: " + ref)
@andyperlitch
andyperlitch / server.js
Created January 24, 2016 05:52
Example gulp setup with a proxy server
'use strict';
var path = require('path');
var gulp = require('gulp');
var conf = require('./conf');
var fs = require('fs');
var browserSync = require('browser-sync');
var browserSyncSpa = require('browser-sync-spa');
@andyperlitch
andyperlitch / README.md
Last active January 6, 2016 22:12
Using d3.layout.circleGraph
<!DOCTYPE html>
<meta charset="utf-8">
<style>
</style>
<script>
function findSquareset(n, divisor) {
@andyperlitch
andyperlitch / Makefile
Last active October 13, 2018 21:57
An example javascript test suite setup using Mocha, Chai, Sinon, Browserify, and PhantomJS.
test:
./node_modules/.bin/browserify test/suite.js > test/suite.bundle.js
./node_modules/.bin/mocha-phantomjs test/runner-cli.html
rm test/suite.bundle.js
.PHONY: test
@andyperlitch
andyperlitch / gist:7163757
Created October 26, 2013 00:12
timeSince function in javascript
function timeSince(timeStamp, options) {
if (typeof timeStamp === "object") {
options = timeStamp;
timeStamp = undefined;
}
options = options || {};
_.defaults(options, {
compareDate: +new Date(),
timeChunk: undefined,
maxUnit: "year",