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 / sortingAlphabetically.js
Created March 15, 2022 15:22 — forked from Thaekeh/sortingAlphabetically.js
Sort arrays alphabetically
computed: {
sortedArray() {
let sortedRecipes = this.recipes;
sortedRecipes = sortedRecipes.sort((a,b) => {
let fa = a.title.toLowerCase(), fb = b.title.toLowerCase();
if (fa < fb) {
return -1
}
if (fa > fb) {
@eclectic-coding
eclectic-coding / _vue-rails.md
Created March 10, 2022 22:22 — forked from przbadu/_vue-rails.md
Vue js and Rails integration

Setup Rails and Vuejs

  1. Generate new rails app using --webpack flag
rails new myApp --webpack=vue

Note:

  1. You can use --webpack=angular for angular application and --webpack=react for react.
@eclectic-coding
eclectic-coding / for-loop-sorted-collection
Created April 7, 2021 11:52 — forked from Phlow/for-loop-sorted-collection
This Liquid loop for Jekyll sorts a collection by date in reverse order
{% comment %}
*
* This loop loops through a collection called `collection_name`
* and sorts it by the front matter variable `date` and than filters
* the collection with `reverse` in reverse order
*
* To make it work you first have to assign the data to a new string
* called `sorted`.
*
{% endcomment %}
@eclectic-coding
eclectic-coding / stimulus.md
Created January 2, 2021 20:18 — forked from mrmartineau/stimulus.md
Stimulus cheatsheet
<?php
/**
* If the aria-label argument has been specified in a wp_dropdown_categories() call,
* output the aria-label option in the <select>
*
* @since 1.0.0
*
* @param string $output HTML Output
* @param array $arguments wp_dropdown_category() arguments
* @return string Modified HTML Output
@eclectic-coding
eclectic-coding / _flash_messages.html.erb
Created September 16, 2020 11:39 — forked from roberto/_flash_messages.html.erb
Rails flash messages using Twitter Bootstrap
<% flash.each do |type, message| %>
<div class="alert <%= bootstrap_class_for(type) %> fade in">
<button class="close" data-dismiss="alert">×</button>
<%= message %>
</div>
<% end %>
@eclectic-coding
eclectic-coding / vim-cheats.md
Created August 2, 2020 14:11 — forked from Starefossen/vim-cheats.md
My vim cheat sheet for working with tabs and window splits.

Tabs

New Tab

  • :tabnew - new blank tab
  • :tabedit [file] - open file in tab

Cursor Movement

  • gt (:tabn) - next tab
@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