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 / time.js
Created January 14, 2022 19:31
codez048: messages time filter
import moment from 'moment';
moment.updateLocale('en', {
monthsShort: [
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
],
});
export default function time(_date) {
@gsans
gsans / SideNav.vue
Created January 14, 2022 19:29
codez047: messages 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 / getters.js
Created January 14, 2022 19:26
codez046: messages vuex getters
import Moment from 'moment';
export default {
profile: state => state.profile,
tweets: state => state.tweets.tweets,
nextTokenTweets: state => state.tweets.nextToken,
joinedDate: state => Moment(state.profile.createdAt).format('MMMM YYYY'),
isSelf: state => screenName => state.profile.screenName == screenName,
followers: state => state.followers.followers,
nextTokenFollowers: state => state.followers.nextToken,
@gsans
gsans / mutations.js
Created January 14, 2022 16:04
codez045: messages 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 / 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) {