Skip to content

Instantly share code, notes, and snippets.

View gsans's full-sized avatar
🚁
Hawaii is Awesome

Gerard Sans gsans

🚁
Hawaii is Awesome
View GitHub Profile
@gsans
gsans / actions.js
Created January 14, 2022 16:02
codez044: messages vuex actions
import {
getMyProfile, getProfileByScreenName, getImageUploadUrl, editMyProfile,
getMyTimeline, tweet, getTweets,
like, unlike, retweet, unretweet, reply,
follow, unfollow,
getFollowers, getFollowing,
search,
getHashTag,
getOnNotifiedSubscription,
listConversations,
@gsans
gsans / Messages.vue
Created January 14, 2022 15:59
codez043: add Messages page
<template>
<div id="app" class="flex container h-full w-full">
<div class="flex container h-full w-full">
<SideNav/>
<div class="w-full sm:w-1/3 md:w-1/2 lg:w-1/2 h-full overflow-y-scroll hidden md:block">
<div class="px-5 py-3 border-b border-lighter flex" @click="deselectAll()">
<h1 class="text-xl font-bold flex-1">Messages</h1>
<i class="fas fa-cog text-xl text-blue cursor-pointer"></i>
<i @click="newMessage()" class="fas fa-plus-circle ml-3 text-xl text-blue cursor-pointer"></i>
## Query.nearbyBikeStations.req.vtl
#set( $distance = $util.defaultIfNull($ctx.args.m, 500) )
#set( $limit = $util.defaultIfNull($ctx.args.limit, 10) )
{
"version": "2017-02-28",
"operation": "GET",
"path": "/bikepoint/doc/_search",
"params": {
"body": {
#if( $context.args.nextToken )"search_after": ["$context.args.nextToken"], #end
@gsans
gsans / SideNav.vue
Created December 7, 2021 16:46
codez042: Add notifications side navigation
<template>
<div class="w-1/6 md:w-1/12 xl:w-1/6 border-r border-lighter lg:px-6 py-2 flex-col justify-between hidden sm:flex">
<div>
<button class="h-12 w-12 hover:bg-lightblue text-3xl text-blue rounded-full">
<i class="ml-2 fab fa-twitter"></i>
</button>
<div>
<button @click="open('Home')" class="focus:outline-none hover:text-blue flex items-center px-4 py-2 hover:bg-transparent md:hover:bg-lightblue rounded-full mr-auto mb-1">
<i class="fa fa-home" :class="$route.name == 'Home'?'text-2xl':'text-xl'" aria-hidden="true"></i>
<p class="text-lg ml-4 text-left hidden xl:block" :class="$route.name == 'Home'?'font-bold':''"> Home</p>
@gsans
gsans / actions.js
Created December 7, 2021 16:41
codez041: authentication vuex actions
import { Auth } from 'aws-amplify'
import router from '../../../router'
export default {
loginUser({ commit }, user) {
commit("USER_LOGIN", user);
},
async logoutUser({ commit, dispatch }) {
await Auth.signOut({
global: true
@gsans
gsans / mutations.js
Last active December 7, 2021 17:14
codez040: notifications vuex mutations
export default {
PROFILE_SET(state, profile) {
state.profile = profile;
},
TWITTER_TIMELINE(state, { tweets, nextToken }) {
state.tweets.tweets = tweets;
state.tweets.nextToken = nextToken;
},
TWITTER_CREATE(state, newTweet) {
@gsans
gsans / Notifications.vue
Created December 7, 2021 16:34
codez039: Add Notifications page
<template>
<div id="app" class="flex container h-full w-full">
<div class="flex container h-full w-full">
<SideNav />
<div class="w-full md:w-1/2 h-full overflow-y-scroll">
<div class="px-5 py-3 border-lighter flex items-center justify-between">
<h1 class="text-xl font-bold">Notifications</h1>
<i class="fas fa-cog text-xl text-blue"></i>
</div>
@gsans
gsans / Profile.vue
Created November 30, 2021 18:59
codez038: Update profile page for non-existent users
<template>
<div id="app" class="flex container h-screen w-full">
<div class="flex container h-screen w-full">
<SideNav />
<div class="w-full md:w-2/3 lg:w-1/2 h-full overflow-y-scroll" v-scroll:bottom="loadMore">
<div class="px-5 py-3 border-b border-lighter flex items-center">
<button @click="gotoHome()" class="rounded-full md:pr-2 focus:outline-none hover:bg-lightblue">
<i class="fas fa-arrow-left text-blue"></i>
</button>
@gsans
gsans / linkify.directive.js
Created November 30, 2021 18:51
codez037: Add linkify directive
import linkifyHtml from 'linkify-html';
import 'linkify-plugin-hashtag';
import 'linkify-plugin-mention';
const options = {
formatHref: {
hashtag: (href) => `#/hashtag?m=Latest&hash=${Date.now()}&q=${escape('#' + href.substr(1))}`,
mention: (href) => `#/${href.substr(1)}`
},
target: (href, type) => (type=='mention' || type=='hashtag')? undefined : '_blank',
@gsans
gsans / tailwind.css
Created November 30, 2021 18:49
codez036: Add hashtag styles
@tailwind base;
@tailwind components;
@tailwind utilities;
html, body {height: 100%;}
button:focus, input:focus {
outline: none;
}