Skip to content

Instantly share code, notes, and snippets.

@jimdoescode
jimdoescode / App.js
Last active January 10, 2020 05:16
An early version of CodeMana
var React = require("react");
var Router = require('react-router');
var GistForm = require("./GistForm.js");
var AppHeader = require("./AppHeader.js");
var AppFooter = require("./AppFooter.js");
var Gist = require("./Gist.js");
var Config = require("./Config.js");
var DefaultRoute = Router.DefaultRoute;
var NotFoundRoute = Router.NotFoundRoute;
@jimdoescode
jimdoescode / DateFromNow.js
Last active December 22, 2015 08:19
Easily format a past date with this object. It has two public methods one that will give a rough estimate with the largest part of time. Something like: 2 hours ago. The second will give you all the parts of time that have elapsed as an object. Parts that are too large are returned as null. Check the comments for more information.
/*
License: MIT
Easily formattable date difference.
DateFromNow(someDate).simple(); //ex. returns '3 days ago';
DateFromNow(someDate).parts(); //ex. returns {years: null, months: null, days: 3, hours: 8, minutes: 52, seconds: 43};
*/
@jimdoescode
jimdoescode / gist:2661872
Last active October 4, 2015 15:37
Testing anonymous gist
var a = 31337;
var b = 1073741824;
function digital_root(num) {
var strnum = num.toString();
while (strnum.length() > 1) {
var runnum = 0;
for (int i = 0; i < strnum.length(); i++) {
runnum += parseInt(s.charAt(i));