- Be a Vim user.
- Install UltiSnips.
- Add the code below to
$YOUR_VIM_FOLDER/UltiSnips/javascript.snippets
.
snippet ii "magic import" b
import `!p
module ReadMarkable | |
extend ActiveSupport::Concern | |
included do | |
has_many :read_marks | |
def touch_read_at | |
update_column(:read_at, Time.now) | |
end |
vundle_outdated() { | |
local -a outdated | |
for plugin in `find ~/.vim/bundle -maxdepth 1 -d 1`; | |
do | |
cd $plugin; | |
current=`git status | grep -c "Your branch is up-to-date with"`; | |
if [[ current -eq 0 ]] { | |
outdated+=$plugin; | |
} | |
cd ..; |
grep -A 1 FoosController#create log/development.log |
// load as early as possible | |
if(process.env.NOW){ | |
require('dotenv').config({path:'./.envnow', silent:true}); | |
}else{ | |
require('dotenv').config({silent:true}); | |
} | |
// now you can deploy with: | |
//$cp .env .envnow && now && rm -r .envnow |
#! /usr/bin/env node | |
'use strict'; | |
const program = require('commander'); | |
const fs = require('fs'); | |
const { spawn } = require('child_process'); | |
program | |
.version('1.0.0') | |
.option('-e, --environment <environment>', 'Environment to deploy to') |
// A Unit test template for Tape | |
// See 5 Questions every unit test must answer: | |
// https://medium.com/javascript-scene/what-every-unit-test-needs-f6cd34d9836d | |
import test from 'tape'; | |
test('What are you testing?', assert => { | |
const msg = 'what should it do?' | |
const actual = 'what was the output?'; |
// @flow | |
import * as React from "react"; | |
const DEFAULT_PIXEL_RATIO = 1; | |
function processPixelRatio(input: ?number): number { | |
return input ?? DEFAULT_PIXEL_RATIO; | |
} | |
// matchMedia feature detection |
import { SessionContext } from "blitz" | |
import db from "db" | |
import { authenticateUser, hashPassword } from "app/auth/auth-utils" | |
import * as z from "zod" | |
// -------------------------------------------- | |
// PROTECT UTIL | |
type Ctx = { session: SessionContext } | |
type ProtectArgs<T> = { schema: T; authorize?: boolean } |