Skip to content

Instantly share code, notes, and snippets.

🚀 Changed my handle to @JosephScript!

Joseph A. Szczesniak JosephScript

🚀 Changed my handle to @JosephScript!
View GitHub Profile
JosephScript / Animate.tsx
Created Mar 20, 2020
An easy way to use CSS transitions in React to animate a child element in and out
View Animate.tsx
import React, { FC, useEffect, useState, ReactNode } from 'react'
import styled from '@emotion/styled'
const FadeInAndOut = styled.p`
transition: opacity 0.5s;
opacity: 0;
&.fadeIn {
opacity: 1;
View nlp.txt
Example Text: It’s what Chrome is a programming using AngularJS is a lightweight jQuery clone, without leaving the desired DOM in software modules, defined by modular programming, in a Web browsers perform just-in-time compilation Native development. Facebook for a creational pattern was engineered as an API for library/framework free JavaScript is a way to post status updates without leaving the intermediate to help run multiple versions of documents BEM is the current JavaScript. Apache Cordova is a project. Wide Web analytics, ad tracking, personalization or submitting data. Edge browser. Redux is ECMAScript 2015 / ES6 code can run both in Java. HTTP requests. XMLHttpRequest is a JavaScript code linter. JSPM is a structural framework for transferring data flow. SpiderMonkey, is the host environment for many frameworks in the performance limitations inherent to act as individual documentations, but more responsive. Virtual DOM is a library for building interactive 3D content for information about the result
# homebrew
/usr/bin/ruby -e "$(curl -fsSL"
# fonts
brew tap homebrew/cask-fonts
brew cask install font-hack-nerd-font
mkdir -p ~/Source
JosephScript / mail.js
Created Jun 15, 2018
Mailgun Zeit Micro Nodejs
View mail.js
const {buffer, text, json} = require('micro')
const Mailgun = require('mailgun-js')
const mailgun = new Mailgun({apiKey: 'api_key', domain: 'domain'})
module.exports = async (req, res) => {
const js = await json(req)
const data = {
from: js.from,
to: '',
subject: 'Hello from Mailgun',
JosephScript / talent_create_tables_data.sql
Created Jan 25, 2016
Example of a one-to-one, one-to-many, and a many-to-many relationship using PostgreSQL
View talent_create_tables_data.sql
/** ---------- TALENT ---------- **/
talent_id serial PRIMARY KEY,
first_name text,
last_name text,
phone text,
created_at timestamp,
updated_at timestamp
JosephScript / giantBomb.js
Created Nov 16, 2015
A simple Giantbomb API request using JSONP for cross origin support.
View giantBomb.js
$.ajax ({
type: 'GET',
dataType: 'jsonp',
crossDomain: true,
jsonp: 'json_callback',
url: '[YOUR_API_KEY]&query=batman'
}).done(function(data) {
alert("success:", data);
}).fail(function() {
JosephScript / catchAll.js
Last active Jan 29, 2016
"Catchall" router for angular apps. Include this router LAST.
View catchAll.js
var express = require('express');
var router = express.Router();
/* handle root angular route redirects */
router.get('/*', function(req, res, next){
var url = req.originalUrl;
if (url.split('.').length > 1){
} else {
// handles angular urls. i.e. anything without a '.' in the url (so static files aren't handled)
JosephScript / LoginCtrl.js
Created Sep 22, 2015
A login controller for AngularJS. This relies on authService.js for token storage, and retrieval.
View LoginCtrl.js
app.controller('LoginCtrl', ['$scope', '$http', '$location', 'authService',
function ($scope, $http, $location, authService) {
$scope.submit = function () {
$'/authenticate', this.form)
.success(function (data, status, headers, config) {
// save json web token in session storage
JosephScript / authInterceptor.js
Last active Mar 14, 2017
An authorization interceptor for AngularJS. This relies on an authorization service, and will send JWT headers with every request. If a 401 error is encountered, the user is redirected to the login page.
View authInterceptor.js
app.factory('authInterceptor', ['$q', '$location', 'authService', function ($q, $location, authService) {
return {
request: function (config) {
config.headers = config.headers || {};
if (authService.isAuthed()) {
config.headers.Authorization = 'Bearer ' + authService.getToken();
return config;
response: function (response) {
JosephScript / authService.js
Created Sep 22, 2015
This is an AngularJS authentication service for using JSON Web Tokens
View authService.js
app.service('authService', ['$window', function ($window) {
this.parseJwt = function (token) {
if (token) {
var base64Url = token.split('.')[1];
var base64 = base64Url.replace('-', '+').replace('_', '/');
return JSON.parse($window.atob(base64));
} else return {};