Skip to content

Instantly share code, notes, and snippets.

View croogie's full-sized avatar

Michał Świtoń croogie

View GitHub Profile
@croogie
croogie / README.md
Created April 6, 2015 11:39 — forked from mbostock/.block
D3: Non-Contiguous Cartogram

Unlike choropleth maps, cartograms encode data using area rather than color, resulting in distorted geographic boundaries. In this example, states are rescaled around their centroid, preserving local shape but not topology. Inspired by Zachary Johnson. Non-continguous cartogram design invented by Judy Olsen. U.S. state and county boundaries from the U.S. Census Bureau, simplified using GDAL and MapShaper.

@croogie
croogie / README.md
Last active August 29, 2015 14:18 — forked from mbostock/.block
D3: Named Transitions II

D3 3.5 allows concurrent transitions on the same element provided the transitions have different names. Here, the “position” transition moves the circles up or down, while the “size” transition makes the circles big or small. The names allow the two transitions to work concurrently without interrupting each other.

If named transitions aren’t used, then a later transition can interrupt an earlier transition, preventing it from completing. For example, if the size transition is started shortly after the position transition, it will prevent some of the circles from reaching the end position.

@croogie
croogie / .gitignore
Created April 6, 2015 11:44 — forked from mbostock/.block
Map Pan & Zoom IV
.DS_Store
build
node_modules
@croogie
croogie / .gitignore
Last active August 29, 2015 14:18 — forked from mbostock/.block
.DS_Store
build
node_modules
@croogie
croogie / gist:2bf3389667f25d0f5140
Last active August 29, 2015 14:27 — forked from kmymtksh/gist:4087912
antigen random theme select one liner
$ antigen-theme `perl -MList::Util=shuffle -MFile::Basename -e 'print +$x = shuffle map { basename($_,".zsh-theme") } glob ".oh-my-zsh/themes/*zsh-theme"'`
@croogie
croogie / react-sortable.html
Last active December 30, 2015 15:45 — forked from petehunt/React sortable
Here's an example of React + jQuery UI sortable. The key thing to note is that we have the render() method do absolutely nothing and use componentDidUpdate() + React.renderComponent() to proxy updates through to the children. This lets us manage the DOM manually but still be able to use all the React goodies you know and love.
<html>
<head>
<title>Test</title>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://fb.me/react-0.5.1.js"></script>
<script src="http://fb.me/JSXTransformer-0.5.1.js"></script>
</head>
@croogie
croogie / oauth.js
Created October 15, 2017 09:42 — forked from srph/oauth.js
axios: interceptor which includes your oauth token in every request as an Authorization header
import axios from 'axios';
// You can use any cookie library or whatever
// library to access your client storage.
import cookie from 'cookie-machine';
axios.interceptors.request.use(function(config) {
const token = cookie.get(__TOKEN_KEY__);
if ( token != null ) {
config.headers.Authorization = `Bearer ${token}`;
@croogie
croogie / download.js
Created September 13, 2018 17:28 — forked from gregbarcza/download.js
Download all image from cloudinary
'use strict'
const cloudinary = require('cloudinary')
const Promise = require('bluebird')
const co = require('co')
const fs = Promise.promisifyAll(require('fs'))
const request = require('request')
const moment = require('moment')
// FILL THIS
cloudinary.config({
cloud_name: '',
@croogie
croogie / index.js
Created August 26, 2019 22:02 — forked from adam-cowley/index.js
Neo4j Driver as an Express Middleware
// Create an express app
const express = require('express');
const app = express();
// Tell it to use Neo4j middleware
app.use(require('./neo4j'));
// Example Route
app.get('/', (req, res) => {
// Create Driver session
@croogie
croogie / .zshrc
Created October 28, 2020 07:17 — forked from matthewmccullough/.zshrc
A configuration to maintain history across sessions and share it across terminals in ZShell
##############################################################################
# History Configuration
##############################################################################
HISTSIZE=5000 #How many lines of history to keep in memory
HISTFILE=~/.zsh_history #Where to save history to disk
SAVEHIST=5000 #Number of history entries to save to disk
#HISTDUP=erase #Erase duplicates in the history file
setopt appendhistory #Append history to the history file (no overwriting)
setopt sharehistory #Share history across terminals
setopt incappendhistory #Immediately append to the history file, not just when a term is killed