This file contains hidden or 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 express = require('express'); // import express | |
const app = express(); | |
/* | |
* A deployment service might set a correct PORT | |
* to use, if no port is set 5000 will probably | |
* be free for use. | |
*/ | |
const port = process.env.PORT || 5000; |
This file contains hidden or 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, { Component } from 'react'; | |
import './App.css'; | |
class App extends Component { | |
constructor(props) { | |
super(props); | |
this.state = {dataText: "data not yet recieved"}; | |
} | |
// this is called once the component is rendered at least once |
This file contains hidden or 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, { Component } from 'react'; | |
import styles from './input-box.module.css'; | |
class UrlInput extends Component { | |
render() { | |
return( | |
<div className={styles.shortenOptions}> | |
<input type="text" placeholder="url to shorten" className={styles.urlInput} tabIndex="1" /> | |
<button className={styles.shortenButton} tabIndex="3">shorten</button> | |
<br /> |
This file contains hidden or 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, { Component } from 'react'; | |
import UrlShortening from './UrlShortening.js'; | |
import './App.css'; | |
class App extends Component { | |
render() { | |
return ( | |
<div className="App"> | |
<div className="Header"> | |
<a className="blogButton" href="https://antiprojects.com/urlmem.html">Blog</a> |
This file contains hidden or 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
function UrlOutput(props) { | |
return ( | |
<> | |
<div className={outputStyles.shortenOutput}> | |
<div className={outputStyles.siteName}> | |
urlmem.com/ | |
</div> | |
<div className={outputStyles.shortWord}> | |
{props.shortUrl} | |
</div> |
This file contains hidden or 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
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') | |
" let Vundle manage Vundle, required |
This file contains hidden or 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
#!/usr/bin/env bash | |
# clone vim and vundle | |
cd ~ | |
git clone https://github.com/vim/vim.git | |
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim | |
# build vim | |
cd vim | |
git checkout a21df1db3ca619afdcb47931af042508a6bbc8e5 |
This file contains hidden or 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
renderOutputs() { | |
return ( | |
<TransitionGroup> | |
{this.state.shortenedUrls.map(UrlPair => | |
<CSSTransition | |
key={UrlPair.id} | |
timeout={300} | |
classNames='latestOut' | |
> | |
<UrlOutput longUrl={UrlPair.longUrl} |
This file contains hidden or 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
// GET route for custom URLs | |
app.get('/custom', (req, res) => { | |
// sanitize input | |
if (typeof (req.query.longUrl) !== "string" || | |
typeof (req.query.customUrl) !== "string") { | |
res.send({"shortened": null}); | |
return; | |
} | |
let longUrl = qualify(req.query.longUrl); |
This file contains hidden or 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
#.env | |
GENERATE_SOURCEMAP=false |