Skip to content

Instantly share code, notes, and snippets.

View eclectic-coding's full-sized avatar
🏠
Working from home

Chuck eclectic-coding

🏠
Working from home
View GitHub Profile
@eclectic-coding
eclectic-coding / promiseCatchWithAwait.js
Created July 8, 2020 14:05 — forked from dbayarchyk/promiseCatchWithAwait.js
Async/await without try/catch in JavaScript
async function fetchAndUpdatePosts() {
const posts = await fetchPosts().catch(() => {
console.log('error in fetching posts');
});
if (posts) {
doSomethingWithPosts(posts);
}
}
# .railsrc
-B #Skip Bundle
-T #Skip Test-Unit
-d postgresql #Use postgres
<template>
<nav id="pagination">
<ul class="page-numbers" v-if="$store.state.totalPageCount">
<li v-for="num in this.pageNumbers" v-if="num != null" v-bind:style="{ width: (100 / pageNumberCount) + '%' }">
<nuxt-link v-if="num != $route.query.page && num != currentPage" :to="{ path: '/', query: { page: num } }">{{ num }}</nuxt-link>
<span v-else>{{ num }}</span>
</li>
</ul>
<ul class="page-guides" v-if="this.$store.state.totalPageCount != 1">
<li>
@eclectic-coding
eclectic-coding / vue.truncate.filter
Created March 26, 2020 16:46
Truncate text filter
filters: {
truncate: function (text, length, suffix) {
if (text.length > length) {
return text.substring(0, length) + suffix;
} else {
return text;
}
},
}

TLTR: Create a Pull Request

  1. Fork this repository.
  2. Clone the your new repository to your system.
  3. Create a new branch (i.e. add/your-name).
  4. Commit changes and push the new branch.
  5. Open and submit a PR.

If you have never opened a PR and need direction, read more below.

@eclectic-coding
eclectic-coding / new_rails_app.md
Created February 6, 2020 18:10 — forked from chair28980/new_rails_app.md
New rails 6 app with postgresql and heroku deployment
@eclectic-coding
eclectic-coding / showAsPrint.js
Created December 13, 2019 12:59 — forked from jscher2000/showAsPrint.js
Emulate print media in Firefox 62 (userscript work in progress)
// For Firefox's Web Console, creates the functions showAsPrint() and undoShowAsPrint()
// to roughly emulate print media and revert
function showAsPrint(){
var docSS = document.styleSheets, ss, oldMedia, newMedia, rules;
var p2s = function(media){
if (media.indexOf('all') > -1) return media; //no need to change
if (media == 'print') return 'all, wasprint'; //show on screen, too
if (media.indexOf('print') > -1 && media.indexOf('screen') > -1) return media; //no need to change
if (media == 'screen') return 'wasscreen'; //hide these rules
if (media.indexOf('screen') > -1) return media.replace('screen', 'wasscreen'); //hide these rules

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
@eclectic-coding
eclectic-coding / README-Template.md
Created November 22, 2019 16:22 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites