Skip to content

Instantly share code, notes, and snippets.

View GraemeFulton's full-sized avatar
😶‍🌫️

Graeme Fulton GraemeFulton

😶‍🌫️
View GitHub Profile
@dsumer
dsumer / TaxRateModel.ts
Last active February 2, 2022 15:07
Apply the correct VAT Rate to your customer in Stripe Checkout
import { Model } from 'objection';
export default class TaxRateModel extends Model {
countryCode!: string;
stripeId!: string;
static tableName = 'tax_rate';
}
@primaryobjects
primaryobjects / react-confirm.js
Created November 1, 2017 19:03
A simple example of a confirm alert dialog in ReactJs / React.
<div className='delete-button' onClick={() => { if (window.confirm('Are you sure you wish to delete this item?')) this.onCancel(item) } } />
@mommaroodles
mommaroodles / wordpress-firebase.php
Created June 16, 2017 21:42 — forked from derekconjar/wordpress-firebase.php
An example of using Firebase and WordPress together. The idea is to use WP's custom post types and metaboxes to make content management easy, and sync with Firebase so that your websites have access to a real-time JSON feed of your custom data.
<?php
/**
* All custom functions should be defined in this class
* and tied to WP hooks/filters w/in the constructor method
*/
class Custom_Functions {
// Custom metaboxes and fields configuration
@hubgit
hubgit / react-wysiwyg-dynamic-import.js
Last active February 15, 2022 09:06
Dynamic import of modules for react-wysiwyg
Promise.all([
import('draft-js'),
import('draftjs-to-html'),
import('html-to-draftjs'),
import('react-draft-wysiwyg'),
import('react-draft-wysiwyg/dist/react-draft-wysiwyg.css')
]).then(([
{ ContentState, EditorState, convertToRaw },
{ default: draftToHtml },
{ default: htmlToDraft },
@mandiwise
mandiwise / Update remote repo
Last active April 17, 2024 07:41
Transfer repo from Bitbucket to Github
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/mandiwise/awesome-new-repo.git
$ git push origin master
$ git remote rm bitbucket
@junaidpv
junaidpv / rgba.js
Created July 31, 2013 07:06
Javascript RGB(A) string conversion functions.
/**
* Parse an rgb or rgba string like 'rgb(67, 216, 89)' or 'rgba(245, 156, 8, 178)'
* to array of integers in the order.
* Credit: http://stackoverflow.com/questions/10970958/get-a-color-component-from-an-rgb-string-in-javascript
**/
function parse_rgb_string(rgb) {
rgb = rgb.replace(/[^\d,]/g, '').split(',');
return rgb;
}