Skip to content

Instantly share code, notes, and snippets.

View mannycolon's full-sized avatar
👨‍💻
Coding Remotely

Manny Colon mannycolon

👨‍💻
Coding Remotely
View GitHub Profile
@dbredvick
dbredvick / text.ts
Created January 12, 2020 00:22
NextJS Twilio Typescript example
import { NextApiResponse, NextApiRequest } from "next";
const twillio = require('twilio');
const authToken = process.env.TWILIO_AUTH_TOKEN;
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const myCellPhoneNumber = process.env.MY_NUMBER;
const superSecretAPIKey = 'ABCD1234';
export default async (req: NextApiRequest, res: NextApiResponse) => {
const client = twillio(accountSid, authToken);
const auth = req.headers.authorization;
@swyxio
swyxio / Timer fallback.js
Created November 14, 2018 01:25
Timer component for use as a Suspense fallback
function Timer() {
const startTime = React.useRef(performance.now());
const [time, setTime] = React.useState(performance.now());
React.useEffect(() => {
const id = setTimeout(() => {
ReactDOM.flushSync(() => {
setTime(performance.now());
});
}, 2);
@RoyalSix
RoyalSix / git-md
Last active August 9, 2017 03:26
Shortcut to merge current branch into develop
#!/bin/bash
# Usage: git md
# Goes in your bin folder, mine is /usr/bin/
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
git checkout origin/develop
git pull origin develop
npm run pull-apps
git checkout $BRANCH_NAME
git merge origin/develop
@schmich
schmich / npm-prerelease.md
Last active June 26, 2024 13:20
Publish a prerelease package to NPM
  • Update package.json, set version to a prerelease version, e.g. 2.0.0-rc1, 3.1.5-rc4, ...
  • Run npm pack to create package
  • Run npm publish <package>.tgz --tag next to publish the package under the next tag
  • Run npm install --save package@next to install prerelease package
@da1nerd
da1nerd / ObjectReader.java
Last active February 23, 2017 17:54
A utility class for reading Java Maps without going insane.
/**
* A utility for reading nested objects without pulling your hair out.
*
* Supported objects: List, Map, JSONObject, JSONArray
*
*/
public class ObjectReader implements Iterable<ObjectReader> {
private final Object map;
/**
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@pjnovas
pjnovas / InstallationStack.md
Last active October 21, 2020 03:59
Complete Install on Ubuntu Server of Nodejs + MongoDB + NGINX

##Ubuntu Server

NodeJS

sudo apt-get install g++ curl libssl-dev apache2-utils git-core make
cd /usr/local/src
wget http://nodejs.org/dist/v0.10.28/node-v0.10.28.tar.gz
tar -xvzf node-v0.10.28.tar.gz
cd node-v0.10.28
@irazasyed
irazasyed / setTimeout-mem-leak.js
Last active July 29, 2024 10:54
JavaScript: setTimeout Memory Leak Prevention.
// https://developer.mozilla.org/en-US/docs/Web/API/window.setTimeout
var timeoutID;
delayedAlert();
function delayedAlert() {
timeoutID = window.setTimeout(slowAlert, 2000);
}
function slowAlert() {
@mikestone14
mikestone14 / gist:11198630
Created April 23, 2014 00:08
Getting a GoDaddy domain to point to a Heroku app.