Skip to content

Instantly share code, notes, and snippets.

Then run the 2 mysql servers with:
/usr/local/bin/mysqld_multi start --tcp-ip 1,2
@jkimbo
jkimbo / utils
Created October 15, 2013 11:38
neo4j bin/utils
#!/bin/bash
# Copyright (c) 2002-2013 "Neo Technology,"
# Network Engine for Objects in Lund AB [http://neotechnology.com]
#
# This file is part of Neo4j.
#
# Neo4j is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@jkimbo
jkimbo / linting-instructions.md
Last active August 29, 2015 14:08
Setting up jshint and jscs for sublime
  • Install the following command line tools (npm install -g MODULE)

    • jshint
    • jscs
    • jsxhint
  • Install Sublime Package Control

  • Using package control install Sublime Linter

  • Install the following packages

    • SublimeLinter-jshint
  • SublimeLinter-jscs
@jkimbo
jkimbo / instructions.md
Created January 26, 2015 18:22
Update npm package
  1. Make sure the repo is in a clean state (and git pull is happy).
  2. npm version lists the current version of your module (if you forgot).
  3. npm version x.y.z updates package.json, commits it with the comment "x.y.z" and tags it as vx.y.z.
  4. git push && git push --tags && npm publish
@jkimbo
jkimbo / react-classname-mixin.js
Last active August 29, 2015 14:15
React Classname Mixin
"use strict";
import React from 'react/addons';
var cx = React.addons.classSet;
var ClassNameMixin = {
propTypes: {
className: React.PropTypes.string
},
@jkimbo
jkimbo / gulpfile.js
Created March 24, 2015 18:23
Mocha testing with gulp
gulp.task('test', function(cb) {
var mocha = require('gulp-mocha');
var React = require('react-tools');
global.initDOM = function() {
var jsdom = require('jsdom');
global.window = jsdom.jsdom().createWindow('<html><body></body></html>');
global.document = global.window.document;
global.navigator = global.window.navigator;
@jkimbo
jkimbo / .eslintrc
Last active August 29, 2015 14:19
ESLint config
{
"ecmaFeatures": {
"arrowFunctions": true,
"binaryLiterals": false,
"blockBindings": true,
"classes": true,
"defaultParams": true,
"destructuring": true,
"forOf": false,
"generators": true,
@jkimbo
jkimbo / snippets.md
Last active August 29, 2015 14:19
Vim snippets

Find and replace

Replace all self.assertEqual statements with assert

:%s/self.assertEqual(\(.*\), \(.*\))/assert \1 == \2/gc

@jkimbo
jkimbo / 0-url-helper.md
Last active August 29, 2015 14:20
Django javascript url helper

Pass the urls you care about to your javascript:

return {
  'urls': js_urls(
    'foo',   # 'foo' => r'^(?P<slug>[a-z0-9-]+)/'
    'bar',   # 'bar' => r'^bar/(?P<id>[0-9-]+)/'
  ),
}
@jkimbo
jkimbo / table-sizes.sql
Created June 1, 2015 14:07
MySQL DB Table sizes
SELECT CONCAT(table_schema, '.', TABLE_NAME),
CONCAT(ROUND(table_rows / 1000, 2), 'K') ROWS,
CONCAT(ROUND(data_length / ( 1024 * 1024 ), 2), 'M') DATA,
CONCAT(ROUND(index_length / ( 1024 * 1024 ), 2), 'M') idx,
CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 ), 2), 'M') total_size,
ROUND(index_length / data_length, 2) idxfrac
FROM information_schema.TABLES
ORDER BY data_length + index_length DESC;