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 / rails-skip.md
Created November 19, 2019 14:16 — forked from AshikNesin/rails-skip.md
Rails generator controller without tests, assets & helpers

Configuring application.rb

To turn off without having to add options:

# application.rb
config.generators.assets = false
config.generators.helper = false

While Generating Controller

@eclectic-coding
eclectic-coding / installkeyringhelper.sh
Last active November 5, 2019 13:00 — forked from keirlawson/installkeyringhelper.sh
Install gnome-keyring git credential helper in Ubuntu 18.04 or higher.
sudo apt-get install libsecret-1-0 libsecret-1-dev
cd /usr/share/doc/git/contrib/credential/libsecret
sudo make
@eclectic-coding
eclectic-coding / gatsby-node.js
Created October 12, 2019 00:33 — forked from sidharthachatterjee/gatsby-node.js
Dynamic GraphQL queries with String interpolation
exports.createPages = ({ graphql, actions }) => {
return graphql(`
{
site {
siteMetadata {
githubOrgs
}
}
}
`).then(result => {
@eclectic-coding
eclectic-coding / csv-search.rb
Created October 6, 2019 14:24 — forked from copiousfreetime/csv-search.rb
Searching through a CSV
#!/usr/bin/env ruby
require 'csv'
# This assumes:
# - Ruby 1.9's CSV library, if you are using 1.8, use FasterCSV.
#
# https://raw.github.com/hadley/data-baby-names/master/baby-names.csv
csv_fname = "baby-names.csv"

TODO: Future Features

This is a running list of features on a wish list to integrate:

  1. Add caching to Geocoder to limit the amount of API calls to convert locations to coordinates.
  2. Add custom weather emoji's based on the icon field from Dark Sky API.
  3. Add settings feature to handle units instead of hard coding them (i.e. mph vs. kmp, F vs. C)
  4. Add caching to Forecast_IO
<?php
/**
* Set up the Grid Loop
* @author Bill Erickson
* @link http://www.billerickson.net/genesis-grid-loop-content/
*
*/
function child_grid_loop_helper() {
genesis_grid_loop( array(
'features' => 2,
@eclectic-coding
eclectic-coding / gist:e3b1f9f2d8315e36dff08bf6828ad6a7
Created February 8, 2019 18:01 — forked from thomasgriffin/gist:4159035
Add custom post types to search results in WordPress.
<?php
add_filter( 'pre_get_posts', 'tgm_io_cpt_search' );
/**
* This function modifies the main WordPress query to include an array of
* post types instead of the default 'post' post type.
*
* @param object $query The original query.
* @return object $query The amended query.
*/
function tgm_io_cpt_search( $query ) {
<?php
class MyTheme
{
private function actionAfterSetup($function)
{
add_action('after_setup_theme', function() use ($function) {
$function();
});
}
<?php
/**
* Register Multiple Taxonomies
*
* @author Bill Erickson
* @link http://www.billerickson.net/code/register-multiple-taxonomies/
*/
function be_register_taxonomies() {
@eclectic-coding
eclectic-coding / utility-pro-frontpage-new-widget.php
Last active June 22, 2017 10:22
Add a new widget area in Carrie Dils Utility Pro theme below the Call to Action Widget.
<?php
/**
* This file adds new widget area called Home-ministry to the front page.
*
* Front page for the Utility Pro theme
*
* @package Utility_Pro
* @author Carrie Dils
* @license GPL-2.0+
*/