Skip to content

Instantly share code, notes, and snippets.

`<iframe src="http://docs.google.com/viewer?url=<file_url>&embedded=true" width=“800" height=“1200” frameborder="0"></iframe>`
@swsalim
swsalim / Scroll Behavior
Created March 18, 2020 03:58
Overriding scrolling behavior on Nuxt
if (process.client) {
if ('scrollRestoration' in window.history) {
window.history.scrollRestoration = 'manual'
// reset scrollRestoration to auto when leaving page, allowing page reload
// and back-navigation from other pages to use the browser to restore the
// scrolling position.
window.addEventListener('beforeunload', () => {
window.history.scrollRestoration = 'auto'
})
// Setting scrollRestoration to manual again when returning to this page.
let bannerText = "MoneySmart Exclusive";
function cardChange() {
var cards = document.querySelectorAll('.listing-card');
cards.forEach(function(card) {
var summary = card.querySelector('.listing-card__summary')
var hasExclusive = card.querySelector('.listing-card__exclusive')
var title = summary.querySelector('.listing-card__title-wrapper')
@swsalim
swsalim / .jsbeautifyrc
Created February 6, 2020 02:03
JS Beautify Config
{
"html": {
"allowed_file_extensions": [
"htm",
"html",
"xhtml",
"shtml",
"xml",
"svg",
"dust"
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@swsalim
swsalim / .csscomb.json
Created February 6, 2020 02:01
CSS Comb config file
{
"exclude": [
".git/**",
"node_modules/**"
],
"remove-empty-rulesets": true,
"always-semicolon": true,
"color-case": "lower",
"block-indent": " ",
"color-shorthand": false,

Frontend Masters: AWS for Frontend Engineers

You should have the following completed on your computer before the workshop:

  • Install the AWS CLI.
  • Have Node.js installed on your system. (Recommended: Use nvm.)
    • Install yarn with brew install yarn.
  • Create an AWS account. (This will require a valid credit card.)
  • Create a Travis CI account. (This should be as simple as logging in via GitHub).
@swsalim
swsalim / Axios Caching
Created January 3, 2020 09:28
Axios caching with LRU Cache
import { cacheAdapterEnhancer } from 'axios-extensions'
import axios from 'axios'
import bodyParser from 'body-parser'
import LRUCache from 'lru-cache'
const cache = require('./cache')
const ONE_HOUR = 1000 * 60 * 60
const defaultCache = new LRUCache({ maxAge: ONE_HOUR })
// setup axios with caching adapter
/* dragging logic for nomadlist.com/dating */
/* by @levelsio */
/* MIT license */
/* <dragging logic> */
$('body').on('mousedown touchstart','.card',function(e) {
if(!currentCardUserId) return;
if($('card.match_card').is(':visible')) return;
if(typeof e.originalEvent.touches !=='undefined') {
/* touch device */
<meta name="pinterest-rich-pin" content="false" />