Skip to content

Instantly share code, notes, and snippets.

View toadkicker's full-sized avatar
🏠
Let's fix some stuff

Todd Baur toadkicker

🏠
Let's fix some stuff
View GitHub Profile
@zolotyx
zolotyx / auth.js
Last active March 6, 2023 06:06
Nuxt Auth Redirect Fix
export const isSameURL = (a, b) => a.split('?')[0] === b.split('?')[0]
export const isRelativeURL = u =>
u && u.length && /^\/[a-zA-Z0-9@\-%_~][/a-zA-Z0-9@\-%_~]*[?]?([^#]*)#?([^#]*)$/.test(u)
export default function ({ app }) {
const redirect = function (name, noRouter = false) {
if (!this.options.redirect) {
return
}
@DreaMinder
DreaMinder / A Nuxt.js VPS production deployment.md
Last active July 31, 2024 13:56
Deployment manual for a real-world project built with nuxt.js + koa + nginx + pm2

Example of deployment process which I use in my Nuxt.js projects. I usually have 3 components running per project: admin-panel SPA, nuxt.js renderer and JSON API.

This manual is relevant for VPS such as DigitalOcean.com or Vultr.com. It's easier to use things like Now for deployment but for most cases VPS gives more flexebillity needed for projects bigger than a landing page.

UPD: This manual now compatible with [email protected]. For older versions deployment, see revision history.


Let's assume that you have entered fresh installation of Ubuntu instance via SSH. Let's rock:

@mojodna
mojodna / 0_register_planet.sql
Last active May 18, 2022 17:51
Sample OSM Athena queries
--
-- This will register the "planet" table within your AWS account
--
CREATE EXTERNAL TABLE planet (
id BIGINT,
type STRING,
tags MAP<STRING,STRING>,
lat DECIMAL(9,7),
lon DECIMAL(10,7),
nds ARRAY<STRUCT<ref: BIGINT>>,
@nickmalcolm
nickmalcolm / AWSLambdaSimpleVoice.js
Last active October 8, 2023 06:18 — forked from stevebowman/AWSLambdaSimpleSMS.js
AWS Lambda Function to make Voice calls via the Twilio API
// 2016 MIT licence. Nick Malcolm.
// Based on https://gist.github.com/stevebowman/7cff9dd80b227c899728
// Makes a call using Twilio's API.
// Expects the following Lambda environment variables:
// TWILIO_ACCOUNT_SID - your account ID
// TWILIO_AUTH_TOKEN - an auth token generated in the Twilio console e.g. ABCD1234
// TWILIO_FROM_NUMBER - the number you've purchased to make calls from e.g. +14243700000
// We'll call this number
@lucijafrkovic
lucijafrkovic / git_retag
Created April 28, 2016 14:02
Retagging on git
1. list all remote tags
git ls-remote --tags
2. delete local tag
git tag -d V_1_0_1
3. push tag deletion to remote
git push origin :refs/tags/V_1_0_1
4. tag local branch again
@IanVaughan
IanVaughan / stash setup
Created March 19, 2016 14:11
Logstash setup
From https://www.digitalocean.com/community/tutorials/how-to-install-elasticsearch-logstash-and-kibana-elk-stack-on-ubuntu-14-04
# ELK Server
## Install Java 8
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
sudo apt-get -y install oracle-java8-installer
@kimisme9386
kimisme9386 / git_hook_repo_name_to_aws_codecommit.sh
Created February 18, 2016 07:08
git hook post recevice for sync to aws codecommit
#!/bin/bash
AWS_CODECOMMIT_URL="git-codecommit.us-east-1.amazonaws.com/v1/repos"
if [ $(git rev-parse --is-bare-repository) = true ]
then
REPOSITORY_BASENAME=$(basename "$PWD")
REPOSITORY_DIRNAME=$(basename $(dirname "$PWD"))
else
REPOSITORY_BASENAME=$(basename $(readlink -nf "$PWD"/..))
@toadkicker
toadkicker / README.md
Last active January 22, 2016 17:49
Environment specific configurations with Gulp for Angular JS (but any old js framework can use this)

To use this task, export MYAPP_ENV=development and call gulp env

@apaatsio
apaatsio / dynamodb-rest-api-lambda.js
Last active September 13, 2019 16:13
Single Lambda function for all CRUD operations with DynamoDB in REST API
console.log('Loading function');
var doc = require('dynamodb-doc');
var dynamo = new doc.DynamoDB();
/**
* Provide an event that contains the following keys:
*
* - operation: one of the operations in the switch statement below
* - tableName: required for operations that interact with DynamoDB
@israelb
israelb / rails_helper.rb
Last active May 15, 2017 04:25
helpers rspec
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rspec/rails'
#require 'spec_helper'
require 'capybara/rspec'
require 'capybara/rails'
require 'capybara/poltergeist'