Skip to content

Instantly share code, notes, and snippets.

Billy Shih bbshih

Block or report user

Report or block bbshih

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bbshih
bbshih / momentMock.js
Last active Jul 2, 2019 — forked from lededje/gist:44aeddf1dc2a5e6064e3b29dc35a7a2d
Jest Mocking Moment to same time zone for tests
View momentMock.js
// To mock globally in all your tests, add to setupTestFrameworkScriptFile in config:
// https://facebook.github.io/jest/docs/en/configuration.html#setuptestframeworkscriptfile-string
jest.mock('moment', () => {
const moment = require.requireActual('moment-timezone');
moment.tz.setDefault('America/Los_Angeles'); // Whatever timezone you want
return moment;
});
View keybase.md

Keybase proof

I hereby claim:

  • I am bbshih on github.
  • I am billyshih (https://keybase.io/billyshih) on keybase.
  • I have a public key whose fingerprint is 6863 969C 0096 38AA 4FF1 1E10 CEAB D8DB B627 4091

To claim this, I am signing this object:

@bbshih
bbshih / form.js
Last active Dec 19, 2015 — forked from ouranos/form.js
Additional JS to use Formtastic-Bootstrap with Client_Side_Validations
View form.js
ClientSideValidations.formBuilders["FormtasticBootstrap::FormBuilder"] = {
add: function (element, settings, message) {
if (element.data('valid') !== false) {
element.data('valid', false);
var $parent = element.closest('.controls');
$parent.parent().addClass('error');
$('<span/>').addClass('help-inline').text(message).appendTo($parent);
} else {
element.parent().find('span.help-inline').text(message);
}
You can’t perform that action at this time.