Skip to content

Instantly share code, notes, and snippets.

View chrisjensen's full-sized avatar

Chris Jensen chrisjensen

View GitHub Profile
@chrisjensen
chrisjensen / dynamic_signup_page.html
Last active April 19, 2016 03:38
Example of an AngularJS directive that will dynamically change the destination page of a NationBuilder signup form.
<div nb-dynamic-page page-id="dynamicPage">
{% form_for signup %}
<input ng-model="dynamicPage" type="text" value="122" name="pageId" />
{% submit_tag "Do this action", class:"submit-button" %}
{% endform_for %}
@chrisjensen
chrisjensen / load-kepla.js
Created July 15, 2017 01:57
Kepla helper
function bootKepla() {
window.setTimeout(window.kepla.bootstrap, 0);
}
$(window).on("load", bootKepla);
/*
Based on the Eric Meyer CSS Reset v2.0 (http://meyerweb.com/eric/tools/css/reset/)
*/
html,
body,
div,
span,
applet,
object,
iframe,
'use strict';
const SENTRY_ID = '';
const SENTRY_KEY = '';
const SENTRY_APP = '';
const PORT = 3000;
const app = require('koa')();
const Router = require('koa-router');
@chrisjensen
chrisjensen / singletonFactory.js
Last active December 5, 2019 20:08
How to create singleton associations in FactoryGirl
/**
* For use with https://github.com/aexmachina/factory-girl
*
* Helper for defining an association to a record that should only be instantiated once.
* Uses sequelizes findOrCreate() to ensure the record is created on
* first invocation, and reused subsequently
*
* NOTE: Make sure to use this within a function initialiser or the singleton
* record will be created when factories are defined which may cause confusion
*
@chrisjensen
chrisjensen / CustomComponent.js
Created July 10, 2019 04:59
QuickLoad and Save examples
/**
* Try adding this component in a page with the url
* /random/:profile
* and going to the url:
* /random/2bc127d0-a2b5-11e9-b219-497155168b2c?event=3b46d0c8-df0e-44a4-8bb6-5eeff03aff46
*/
(RaiselyComponents, React) => {
const { quickLoad, save } = RaiselyComponents.api;
const { Button } = RaiselyComponents.Atoms;
const { Spinner } = RaiselyComponents;
@chrisjensen
chrisjensen / Console output
Last active October 17, 2019 01:24
Rapyd API attempt
to_sign: get/v1/payment_methods/country?country=SG&currency=SGD<redacted>
{ timestamp: '1571275418',
salt: 1249378312,
'Content-Type': 'application/json',
signature: 'ODEzOTlmNGRkMDE4MWFkYjFlOGRiYThlYTA3YzUyMjBkZmM5ZjY4YWQzNmZlN2M1ZWI3MWUzZjRjZmFjMjM4YQ==',
access_key: 'D7DF0851A8CB803DC3D2',
'User-Agent': 'Request-Promise' }
(node:27267) UnhandledPromiseRejectionWarning: StatusCodeError: 401 - {"status":{"error_code":"UNAUTHENTICATED_API_CALL","status":"ERROR","message":"Invalid signature","response_code":"UNAUTHENTICATED_API_CALL","operation_id":"4f59bef8-9383-4015-8487-5278b19c81db"}}
at new StatusCodeError (/Users/chrisjensen/Sites/test/node_modules/request-promise-core/lib/errors.js:32:15)
const tzc = require('timezonecomplete');
const SingaporeTime = tzc.TimeZone('Singapore/Singapore');
const MelbourneTime = tzc.TimeZone('Australia/Melbourne');
const timeInSingapore = new tzc.DateTime('2019-12-01 08:30', SingaporeTime);
// Same UTC time, different offset
timeInSingapore.convert(MelbourneTime);
@chrisjensen
chrisjensen / progress.html
Last active April 12, 2022 06:40
Raisely Progress Bar in Streamlabs
<div class="progress-bar progress-bar--size-large progress-bar--style-rounded">
<div class="progress-bar__progress">
<span class="progress-bar__total">0</span>
<span class="progress-bar__goal">0</span>
<span class="progress-bar__bar progress-bar__bar--animated">
<span class="progress-bar__total">0</span>
<span class="progress-bar__goal">0</span>
</span>
</div>
</div>
@chrisjensen
chrisjensen / feed.html
Last active April 27, 2020 12:32
Raisely Donation Feed in Streamlabs
<script type="text/template" id="eventlist_item">
<div class="donation-stream__item">
<div class="donation-tile">
<div class="donation-tile__amount"><span>{tag}</span></div>
<div class="donation-tile__content">
<p class="donation-tile__content__activity">{from}</p>
</div>
</div>
</div>
</script>