Skip to content

Instantly share code, notes, and snippets.

@solace
solace / CustomModalBody.js
Last active April 20, 2021 13:30
Use react-bootstrap-typeahead with react-bootstrap-table
import React from 'react';
import editor from 'react-bootstrap-table/lib/Editor';
// Copied wholesale from react-bootstrap-table, modified where noted
class CustomModalBody extends React.Component {
getFieldValue() {
const newRow = {};
this.props.columns.forEach((column, i) => {
let inputVal;
@solace
solace / MapComponent.jsx
Last active March 5, 2021 07:57
Updating map bounds using react-google-maps
/* Only the necessary information to address
* https://github.com/tomchentw/react-google-maps/issues/183#issuecomment-220705977
* has been included here.
*
* YMMV.
*/
import React from 'react';
// Need these to muck around with bounds
@solace
solace / admin.py
Created January 3, 2021 08:09
django-addanother with django-autocomplete-light and GenericForeignKeys
# Source: https://github.com/yourlabs/django-autocomplete-light/blob/master/test_project/select2_generic_foreign_key/admin.py
import json
from django.contrib import admin
from django.contrib.admin.options import IS_POPUP_VAR, TO_FIELD_VAR
from django.contrib.contenttypes.models import ContentType
from django.template.response import TemplateResponse
from .forms import TForm
@solace
solace / extend-email-send.md
Last active November 20, 2020 06:58
Meteor: Extend default Email.send invocation

Use a non-SMTP mail method in Meteor

Requirements:

  • lodash (or underscore, you may need to change your _ functions to suit)
  • Meteor email package
Meteor.startup(function () {
 var sendEmail = _.bind(Email.send, Email);
@solace
solace / README.md
Created October 14, 2020 04:40
Custom SVG Definition for @fortawesome/react-fontawesome

Usage

Wherever you are initialising the FontAwesome library:

import { library } from '@fortawesome/fontawesome-svg-core';
import faTheName from 'custom-icon';

...
@solace
solace / fontawesome4to5.js
Last active March 6, 2020 02:04 — forked from timint/fontawesome4to5.js
Migrate Fontawesome 4 to 5 using jQuery (For the CSS Webfont version)
/*
* Migrate Fontawesome 4 to Fontawesome 5
* @website https://www.litecart.net/
*/
(function($){
var icons = {
"fa-500px": "fab fa-500px",
"fa-address-book-o": "far fa-address-book",
"fa-address-card-o": "far fa-address-card",
@solace
solace / WordPress to Buffer (Single Channel)
Last active March 4, 2019 04:22
Wordpress to Social Media via IFTTT - Messages with Hashtags
type Dict = { [key: string]: number };
const hashtags: Dict = {};
Wordpress.anyNewPostWp.TagsAndCategories.split(',').map(
s => hashtags['#' + s.toLowerCase().replace(/[\s-]+/g, '')] = 1
);
Buffer.addToBuffer.setMessage(
Wordpress.anyNewPostWp.PostTitle + "\n" +
Object.keys(hashtags).join(' ') + "\n" +
@solace
solace / keybase.md
Last active October 25, 2018 02:25
keybase.md

Keybase proof

I hereby claim:

  • I am solace on github.
  • I am solace (https://keybase.io/solace) on keybase.
  • I have a public key ASBFfPwLOZyVzGD49DMuAY9WrHnQsvPysM54dAvkYD2G1Qo

To claim this, I am signing this object:

@solace
solace / sphp-changes
Created June 14, 2018 12:04
Update sphp to support PHP 5.5
# Update the support arrays to include 5.5.
brew_array=("5.5","5.6","7.0","7.1","7.2")
php_array=("php@5.5" "php@5.6" "php@7.0" "php@7.1" "php@7.2")
valet_support_php_version_array=("php@5.5" "php@5.6" "php@7.0" "php@7.1" "php@7.2")
# Search for the `brew link --force "$php_version"` line, and replace it with this.
if [[ $(echo "$php_version" | sed 's/^php@//' | sed 's/\.//') -lt 56 ]]
then
brew link --force --overwrite "$php_version"
else
@solace
solace / meteor-mantra-meld.js
Last active February 20, 2016 06:47
splendido:accounts-meld with mantra-sample-blog-app
/**
* Get `splendido:accounts-meld` working with the Mantra sample Blog App
*
* Create a file that looks something like this in your `/server`
*
* Caveat: No guarantees, negligible support, YMMV. If you have a better way, let me know.
*/
import {Meteor} from 'meteor/meteor';
import _ from 'lodash';