This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 {}; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.controller('LoginCtrl', ['$scope', '$http', '$location', 'authService', | |
function ($scope, $http, $location, authService) { | |
$scope.submit = function () { | |
$http.post('/authenticate', this.form) | |
.success(function (data, status, headers, config) { | |
// save json web token in session storage | |
authService.saveToken(data.token); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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){ | |
next(); | |
} else { | |
// handles angular urls. i.e. anything without a '.' in the url (so static files aren't handled) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax ({ | |
type: 'GET', | |
dataType: 'jsonp', | |
crossDomain: true, | |
jsonp: 'json_callback', | |
url: 'http://www.giantbomb.com/api/search/?format=jsonp&api_key=[YOUR_API_KEY]&query=batman' | |
}).done(function(data) { | |
alert("success:", data); | |
}).fail(function() { | |
alert("error"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** ---------- TALENT ---------- **/ | |
DROP TABLE IF EXISTS talent CASCADE; | |
CREATE TABLE talent ( | |
talent_id serial PRIMARY KEY, | |
first_name text, | |
last_name text, | |
phone text, | |
created_at timestamp, | |
updated_at timestamp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: '[email protected]', | |
subject: 'Hello from Mailgun', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# homebrew | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
# fonts | |
brew tap homebrew/cask-fonts | |
brew cask install font-hack-nerd-font | |
mkdir -p ~/Source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
` |
OlderNewer