Skip to content

Instantly share code, notes, and snippets.

View primaryobjects's full-sized avatar

Kory Becker primaryobjects

View GitHub Profile
@primaryobjects
primaryobjects / console.js
Created June 8, 2017 18:20
Overwrites console.log to send messages to a server.
(function(){
var oldLog = console.log;
console.log = function (message) {
// DO MESSAGE HERE.
alert('hi!');
oldLog.apply(console, arguments);
};
})();
@primaryobjects
primaryobjects / index.js
Created May 30, 2017 20:43
Bug fix for react-timeago https://github.com/nmn/react-timeago/issues/81. Replace node_modules/react-timeago/lib/index.js
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
@primaryobjects
primaryobjects / aknights.png
Last active May 24, 2017 18:27
[2017-05-22] Challenge #316 [Easy] Knight's Metric. Demo https://plnkr.co/edit/c6DBp8lF96R6U2huIltF?p=preview
aknights.png
@primaryobjects
primaryobjects / client.js
Created May 12, 2017 18:01
Returns the full DOM path for an element. Example: body div div#target
$(function() {
$('#target').click(function() {
var selector = (getDomPath(this) + '').replace(/,/g, ' ');
var e = $(selector);
console.log(selector);
});
})
@primaryobjects
primaryobjects / 1-callback.js
Last active May 8, 2017 19:05
Callbacks, promises, and async await tutorial. Demo at https://jsfiddle.net/f6kwv1w6/
var one = function(name, callback) {
var result = 'Hello, ' + name + '!';
var err = null;
if (!name) {
err = 'name is empty.';
}
if (callback) {
callback(err, result);
@primaryobjects
primaryobjects / collapsible.png
Last active April 22, 2022 22:35
Collapsible tabs example in Bootstrap 4 alpha. Resize the page to see the tabs collapse into a dropdown menu. See demo https://plnkr.co/edit/6WVKhJcqfRNP6pDoq85N?p=preview
collapsible.png
@primaryobjects
primaryobjects / index.html
Created April 21, 2017 21:34
Dynamically rendering a react component and passing in jquery context.
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script data-require="react@*" data-semver="15.2.0" src="https://cdnjs.cloudflare.com/ajax/libs/react/15.2.0/react.min.js"></script>
<script data-require="react@*" data-semver="15.2.0" src="https://cdnjs.cloudflare.com/ajax/libs/react/15.2.0/react-dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.24.0/babel.min.js"></script>
</head>
@primaryobjects
primaryobjects / example.png
Last active June 23, 2022 04:44
A simple navbar for Milligram CSS. See demo at http://jsbin.com/penodof/edit?output
example.png
@primaryobjects
primaryobjects / css-comparison.csv
Last active April 11, 2025 19:11
A comparison of CSS library sizes.
Name Version Size (uncompressed) Size (minified) Size (gzipped) URL
Bootstrap v3.3.7 143 KB 117 KB 20 KB http://getbootstrap.com/css/
Bootstrap v4.0.0 187 KB 147 KB 20 KB https://v4-alpha.getbootstrap.com/
Materialize v3.0 114 KB 90 KB 18 KB http://materializecss.com/
Material Design Lite v1.3.0 350 KB 137 KB 21 KB https://getmdl.io/
mini.css v2.1 47 KB 36 KB 7 KB https://chalarangelo.github.io/mini.css/
Semantic UI v2.2.6 730 KB 550 KB 95 KB https://semantic-ui.com/
Foundation v3.0 90 KB 64 KB 12 KB http://foundation.zurb.com/
Pure CSS v0.6.2 80 KB 17 KB 3.8 KB https://purecss.io/
Picnic CSS v6.3.2 55 KB 38 KB 7 KB https://picnicss.com
#
# [2017-04-08] Weekly #27 - Mini Challenges - Roller Coaster Words
# Given: A roller coaster word is a word with letters that alternate between going forward and backward in alphabet. One such word is "decriminalization". Can you find other examples of roller coaster words in the English dictionary?
# https://www.reddit.com/r/dailyprogrammer/comments/60b63i/weekly_27_mini_challenges/df4w9bn/
#
# by Kory Becker
# http://primaryobjects.com
#
# Install packages if needed.