Skip to content

Instantly share code, notes, and snippets.

View maximilian-lindsey's full-sized avatar

Maximilian Lindsey maximilian-lindsey

View GitHub Profile
@clineamb
clineamb / app.js
Last active June 6, 2018 01:53
[DEPRECIATED] Nunjucks 1.0.7 + Express 4.9.2
/*
* Nunjucks + Express
* I couldn't find anything that helped me setup the enviornment
* correctly for these in the latest vesion of Express 4 (at the time
* of writing this).
*
* This Gist for those that want to keep using Nunjucks with Express 4.
* This also goes over working with a Nunjucks environment to use custom
* filters, extensions, etc.
*
@edwardhotchkiss
edwardhotchkiss / graphics_magick_center_image_on_canvas.js
Created October 31, 2012 03:32
Use GM Module (Graphics Magick) for Node.js to center an image on a white background canvas
var gm = require('gm');
var canvasWidth = 248;
var canvasHeight = 389;
gm(__dirname + '/original.jpg').size(function(error, size) {
if (error) {
console.error(error);
@mshick
mshick / install.sh
Last active April 2, 2020 10:01
Installing Node.js with Homebrew and nvm
# Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install nvm
brew install nvm
# Export nvm environment
export NVM_DIR="$HOME/.nvm"
. "$(brew --prefix nvm)/nvm.sh"
@Neo23x0
Neo23x0 / fix-sourcetree-git-secrets.sh
Created October 27, 2018 20:30
SourceTree git-secrets
#!/bin/bash
#
# Fixes error:
# git: 'secrets' is not a git command. See 'git --help'.
#
# 1. Go to SourceTree preferences > Git > Use System Git
# Select the system's git e.g. /usr/local/git/bin/git
# 2. Run this script
# Adust the path if your system's git is located in a different folder
# git-secrets must be linked in the same folder as the system's git binary

React Native Folder Structure

Motivations

  • Sharing what has worked for me in different React Native projects
  • Reusing screens in different parts of your app
  • Easy to work separately in a feature
  • Add an extra level (nested folder) only when necessary
  • Don't overuse index.js for everything
@EspadaV8
EspadaV8 / gist:1357237
Created November 11, 2011 05:04
Script to import Geonames into PostgreSQL taken from http://forum.geonames.org/gforum/posts/list/15/926.page
#!/bin/bash
#===============================================================================
#
# FILE: getgeo.sh
#
# USAGE: ./getgeo.sh
#
# DESCRIPTION: run the script so that the geodata will be downloaded and inserted into your
# database
#
@kristoferjoseph
kristoferjoseph / watch.ts
Last active May 4, 2022 19:33
deno file watcher test runner
import { exec } from "https://deno.land/x/exec/mod.ts";
const watcher = Deno.watchFs("./");
for await (const event of watcher) {
// if you're curious
// let kind = event.kind
// console.log('EVENT KIND: ', kind)
await exec('clear')
await exec('deno test --allow-read')
}
@yesvods
yesvods / gist:51af798dd1e7058625f4
Created August 15, 2015 11:13
Merge Arrays in one with ES6 Array spread
const arr1 = [1,2,3]
const arr2 = [4,5,6]
const arr3 = [...arr1, ...arr2] //arr3 ==> [1,2,3,4,5,6]
@sogko
sogko / app.js
Last active November 8, 2022 12:31
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
@nhagen
nhagen / PromisAllWithFails.js
Last active November 15, 2022 18:11
Wait until all promises have completed even when some reject, with Promise.all
var a = ["sdfdf", "http://oooooolol"],
handleNetErr = function(e) { return e };
Promise.all(fetch('sdfdsf').catch(handleNetErr), fetch('http://invalidurl').catch(handleNetErr))
.then(function(sdf, invalid) {
console.log(sdf, invalid) // [Response, TypeError]
})
.catch(function(err) {
console.log(err);
})