Skip to content

Instantly share code, notes, and snippets.

View jsjoeio's full-sized avatar

Joe Previte jsjoeio

View GitHub Profile
@jsjoeio
jsjoeio / git_update_local.sh
Last active August 21, 2018 22:48
Git Alias - delete local branches that don't exist locally
# I chose 'prune' because it stands for 'prune branches'
alias prune="git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d"
## Credit goes to @TSMMARK - original gist https://gist.github.com/TSMMark/99d7153c97b0c0762bd6105f0e39f8e2
@jsjoeio
jsjoeio / deploy.js
Created September 2, 2018 02:47
How to Automate Your Chrome Extension Deployment with Travis CI
/*
Credit goes to Gokul Kathirvel who wrote the tutorial where this code comes from <3
https://dev.to/gokatz/automate-your-chrome-extension-deployment-in-minutes-48gb
*/
const zipFolder = require('zip-folder')
const exec = require('child_process').exec
const folder = 'dist'
const zipName = 'extension.zip'
@jsjoeio
jsjoeio / alias.sh
Created October 23, 2018 15:06
Alias to Run Chrome Without Address Bar
alias detached="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome $hrome --app=https://google.com"
@jsjoeio
jsjoeio / app.js
Created November 17, 2018 22:31
Identify Unknown Phone Numbers with JavaScript, Twilio Lookup and SMS - Source Code
exports.handler = async function(context, event, callback) {
// initialize Twilio client
const client = context.getTwilioClient();
function parseNumber(message) {
// Check to make sure there are at least two numbers
if(message.match(/\d{2,}/g)) {
const cleanedUpNumber = message.replace(/[-() ]/g, '');
// Check if it's less than 10 digits
if (cleanedUpNumber.length < 10) {
@jsjoeio
jsjoeio / keybindings.json
Last active August 30, 2019 19:04
VSCode Shortcuts to toggle between Activity Bar views/icons
// Place your key bindings in this file to override the defaultsauto[]
[
{
"key": "cmd+p",
"command": "workbench.action.showAllSymbols"
},
{
"key": "cmd+t",
"command": "-workbench.action.showAllSymbols"
},
@jsjoeio
jsjoeio / keybindings.json
Created September 4, 2019 02:30
egghead - Add a Keyboard Shortcut to Switch Between the Workbench and the Integrated Terminal
[
{ "key": "ctrl+=", "command": "workbench.action.terminal.focus" },
{
"key": "ctrl+=",
"command": "workbench.action.focusActiveEditorGroup",
"when": "terminalFocus"
},
]
@jsjoeio
jsjoeio / keybindings.json
Created September 4, 2019 02:56
egghead - Add a Keyboard Shortcut to Toggle Between the Activity Bar Icons
[
{
"key": "ctrl+]",
"command": "workbench.action.nextSideBarView",
"when": "sideBarFocus"
},
{
"key": "ctrl+[",
"command": "workbench.action.previousSideBarView",
"when": "sideBarFocus"
@jsjoeio
jsjoeio / Header.tsx
Last active December 10, 2019 03:26
React TypeScript: function delclaration vs. function expression
import React from 'react'
// Written as a function declaration
function Heading(): React.Node {
return <h1>My Website Heading</h1>
}
// Written as a function expression
const OtherHeading: React.FC = () => <h1>My Website Heading</h1>
@jsjoeio
jsjoeio / example.tsx
Created December 12, 2019 14:07
React TypeScript Component: Function Declaration vs. Function Expression
import React from 'react'
// Written as a function declaration
function Heading(): React.Node {
return <h1>My Website Heading</h1>
}
// Written as a function expression
const OtherHeading: React.FC = () => <h1>My Website Heading</h1>
@jsjoeio
jsjoeio / Header.tsx
Last active December 31, 2019 19:28
React component
import React from 'react'
type Props = {
text: string;
color: string;
}
export const Header: React.FC<Props> = ({text = 'Hello world!', color = 'red'}) => {
return <h1 style={{ color }}>{text}</h1>
}