Skip to content

Instantly share code, notes, and snippets.

View rveitch's full-sized avatar

Ryan Veitch rveitch

View GitHub Profile
@rveitch
rveitch / ember-helper-example.md
Last active June 10, 2020 19:09
Ember Helpers Example
// Ember Template
<div class="progress-track" style="{{chart-value-style percentValue=@model.balance.common.percentage stylePrefix='left'}}"></div>
// Rendered Result
<div class="progress-track" style="left:67%"></div>
{
"accessible": {
"syllables": {
"count": 4,
"list": [
"ac",
"ces",
"si",
"ble"
]
@rveitch
rveitch / analysis.json
Last active May 4, 2020 04:44
comprehend
{
"headline": "Why Using Social Media Without Strategy is a Waste of Time and Effort With John Meese From Platform University",
"score": null,
"summary": {
"wordCount": 19,
"characterCount": 110,
"sentiment": {
"Sentiment": "NEGATIVE",
"SentimentScore": {
"Positive": 0.001413671299815178,
@rveitch
rveitch / controllers.application\.js
Created April 29, 2020 21:25
ember-nested-components
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
@rveitch
rveitch / get-the-date-filter.php
Created March 11, 2020 22:00
PHP Warning: gmdate() expects parameter 2 to be integer, string given in /wp-admin/includes/dashboard.php on line 934
<?php
function et_last_modified_date_blog( $the_date, $format ) {
if ( 'post' === get_post_type() && 'U' !== $format ) { // Make sure the Unix timestamp is not being requested.
$the_time = get_post_time( 'His' );
$the_modified = get_post_modified_time( 'His' );
$last_modified = sprintf( __( 'Last updated %s', 'Divi' ), esc_html( get_post_modified_time( 'M j, Y' ) ) );
$published = sprintf( __( 'Published on %s', 'Divi' ), esc_html( get_post_time( 'M j, Y' ) ) );
@rveitch
rveitch / custom-errors.js
Last active September 22, 2020 16:15
Node Custom Errors Examples
// REFERENCE: https://gist.github.com/slavafomin/b164e3e710a6fc9352c934b9073e7216
const generateMessage = (message, code, subcode) => {
let errorCoding = '';
if (code) errorCoding = `Code: ${code}`;
if (subcode) errorCoding = errorCoding + ` Subcode: ${subcode}`;
return `${message} ${errorCoding}`;
};
class CustomError extends Error {
@rveitch
rveitch / update-node-via-nvm.bash
Created November 1, 2019 19:57
Update Node via NVM
oldNode=$(nvm current) && nvm install 12.13.0 && nvm --reinstall-packages-from=${oldNode} && nvm alias default 12.13.0 && echo Now Using Node $(nvm current)
@rveitch
rveitch / node-schedule-example.js
Created October 2, 2019 18:17
Node Schedule Example
const schedule = require('node-schedule'); // https://github.com/node-schedule/node-schedule
const job = schedule.scheduleJob('55 23 * * SUN', () => {
console.log('I am a job scheduled to run at 23:55 every Sunday.');
});
console.log('job.nextInvocation:', job.nextInvocation().toString());
@rveitch
rveitch / mtg-osx-wine-update.md
Last active May 9, 2019 19:15
How to Update MTG Arena on OSX (Wine) Without Re-downloading All The Content
  1. Right-click on MTGArena in Applications and select "Show Package Content" Show Content
  2. Navigate to the Downloads path
@rveitch
rveitch / cos-human-readable-mime-type-map.js
Last active March 6, 2019 18:04
CoSchedule Most Popular Mime Types Map
[
{
name: '3GP',
mime_type: ['video/3gpp'],
extension: ['3gp']
},
{
name: 'Adobe Photoshop Document',
mime_type: ['application/x-photoshop'],
extension: ['psd']