Skip to content

Instantly share code, notes, and snippets.

View cabgfx's full-sized avatar

Casper Klenz-Kitenge cabgfx

View GitHub Profile
@7ute
7ute / MY_NAMESPACE_sitemap_provider.php
Created January 26, 2023 10:33
Yoast custom sitemap provider
<?php
/**
* These class and hook allow exposing your data to Yoast, for it to build
* the sitemap, split it correctly in multiple pages every 1000 entries,
* and add it to its index. Here's a list of the placeholders I used :
* - MY_NAMESPACE: your Plugin/theme/custom namespace
*
* - MY_CUSTOM_DATATYPE: The type of data you're exposing in those sitemaps
* - MY_CUSTOM_DATATABLE: Database table hosting your data
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@mustardBees
mustardBees / cmd.sh
Created May 11, 2020 13:48
WordPress clear oEmbed cache (YouTube etc.) for all posts/pages using WP-CLI
wp post list --post_type=post,page --field=ID | xargs -n1 -I % wp embed cache clear %
@joshuap
joshuap / jumpstart_heya.md
Last active December 9, 2021 15:50
Configuring Jumpstart to send a welcome sequence w/ Heya
@leastbad
leastbad / action_mailbox.md
Last active April 26, 2023 04:30
Action Mailbox: The Missing Manual

This is all you really need to know in order to make Action Mailbox work in development.

  1. Fire up ngrok http 3000 and make note of your subdomain for steps 3 and 8.
  2. Create a Mailgun account because they offer sandbox addresses; grab your domain from the Dashboard.
  3. Go into Receiving and create a catch-all route pointing to: https://XXX.ngrok.io/rails/action_mailbox/mailgun/inbound_emails/mime
  4. Add your Mailgun API key to your credentials:
action_mailbox:
 mailgun_api_key: API KEY HERE
@asadkn
asadkn / wp-instagram-widget.php
Created February 12, 2019 19:47
Flood prevention and persistent storage for data of WP Instagram Widget.
<?php
/*
Plugin Name: WP Instagram Widget
Plugin URI: https://github.com/scottsweb/wp-instagram-widget
Description: A WordPress widget for showing your latest Instagram photos.
Version: 2.0.3
Author: Scott Evans
Author URI: https://scott.ee
Text Domain: wp-instagram-widget
Domain Path: /assets/languages/
@brianpurkiss
brianpurkiss / Gravity Forms + Bootstrap 4
Last active April 7, 2022 13:21 — forked from kirandash/Gravity Forms + Bootstrap
Helpful function for adding Bootstrap 4 classes to Gravity Forms fields.
<?php
/**
* Gravity Forms Bootstrap Styles
*
* Applies bootstrap classes to various common field types.
* Requires Bootstrap to be in use by the theme.
*
* Using this function allows use of Gravity Forms default CSS
* in conjuction with Bootstrap (benefit for fields types such as Address).
*
@cdesch
cdesch / rails_generator_cheat_sheet.md
Last active March 30, 2024 09:07
Rails Generator CheatSheet

Cheat Sheets are greate but they are not a substitute for learning the framework and reading the documentation as we most certainly have not covered every potential example here. Please refer to the Rails Command Line Docs for more information.

Command Line Generator Info

Reference

You can get all of this information on the command line.

rails generate with no generator name will output a list of all available generators and some information about global options. rails generate GENERATOR --help will list the options that can be passed to the specified generator.

@jperry
jperry / remote_authenticatable.rb
Last active February 8, 2023 15:48
Devise and warden remote authentication
module Devise
module Models
module RemoteAuthenticatable
extend ActiveSupport::Concern
#
# Here you do the request to the external webservice
#
# If the authentication is successful you should return
# a resource instance