Skip to content

Instantly share code, notes, and snippets.

@andrewxhill
andrewxhill / cdb_import.sh
Last active December 19, 2015 02:39 — forked from luisbosque/cdb_import.sh
Import CartoDB file with cURL
#!/bin/bash
CDB_USER=$1
API_KEY=$2
IMPORT_FILE=$3
if [[ -z $CDB_USER ]]
then
echo "Missing user"
fi
@jasonlewis
jasonlewis / create-project.sh
Last active February 10, 2023 12:04
Bash script that creates a new project and virtual host for that project. Can also be used to quickly create a new Laravel project.
#!/bin/bash
# This script creates a new project (or site) under /var/sites and creates
# new virtual host for that site. With the options a site can also
# install the latest version of Laravel directly.
# This script was originally based on the following script by @Nek from
# Coderwall: https://coderwall.com/p/cqoplg
# Display the usage information of the command.
create-project-usage() {
@Bouke
Bouke / gist:11261620
Last active August 3, 2023 01:46
Multiple Python installations on OS X

Previous versions used homebrew to install the various versions. As suggested in the comments, it's better to use pyenv instead. If you are looking for the previous version of this document, see the revision history.

$ brew update
$ brew install pyenv
$ pyenv install 3.5.0
$ pyenv install 3.4.3
$ pyenv install 3.3.6
$ pyenv install 3.2.6
$ pyenv install 2.7.10

$ pyenv install 2.6.9

@jakub-g
jakub-g / cleanEmptyFoldersRecursively.js
Created April 3, 2015 15:31
nodejs: remove empty directories recursively
function cleanEmptyFoldersRecursively(folder) {
var fs = require('fs');
var path = require('path');
var isDir = fs.statSync(folder).isDirectory();
if (!isDir) {
return;
}
var files = fs.readdirSync(folder);
@eesur
eesur / README.md
Last active November 6, 2019 08:21
d3 | SVG to the front and back

Moving an SVG selection to the front/back

Rolling over boxes bring them to front, and clicking them sends them to the back.

D3 is often used to create and manipulate SVG. Other than with HTML, the order of SVG elements define their visibility (whereas in HTML we have something like z-index). So we are often missing the functionality of moving an SVG selection to the front/back as it is known from Adobe Illustrator.

source: d3-extended

//Create's a 1x1 transparent base layer so that the globe has no imagery
var transparentBaseLayer = new Cesium.SingleTileImageryProvider({
url : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNgYAAAAAMAASsJTYQAAAAASUVORK5CYII="
});
//Create the viewer, must specify alpha :true in order for the globe and
//background to be transparent
var viewer = new Cesium.Viewer('cesiumContainer', {
skyBox : false,
skyAtmosphere : false,
@bsergean
bsergean / README.md
Last active January 23, 2024 17:50
Anti-aliasing (FXAA) with headless-gl and three.js

Aliased

Anti-aliased

Getting the code

@ciases
ciases / git-zip-changed-files.md
Last active March 23, 2024 16:37
Git: zip changed files + diff

GIT: zip changed files + diff

Create zip archive with changed files

git archive -o update.zip HEAD $(git diff --name-only <starting SHA> HEAD)

or

Index

Preface

Together with HellMood we won this year's (2016) JS1K competition and thought this might be a good opportunity to write about the development process and my motivation behind it. If you're already familiar with JS1K, feel free to skip the next two paragraphs.

@sindresorhus
sindresorhus / esm-package.md
Last active May 18, 2024 09:04
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.