Skip to content

Instantly share code, notes, and snippets.

View jimthedev's full-sized avatar

Jim Cummins jimthedev

View GitHub Profile
@jimthedev
jimthedev / README.md
Last active June 22, 2018 17:21
Label Service Toc

Welcome to our readme. Check out Google.

{
"services": [
{
"id": 12345,
"slug": "label-service",
"name": "Label Service",
"docs": "https://raw.githubusercontent.com/jimthedev/example-svc-docs/master/"
},
{
"id": 91234,
@jimthedev
jimthedev / iota.seed.generate.js
Created August 23, 2017 22:30
iota in browser seed generate with javascript including testing of distribution
const distr = {};
let x = 1000;
while(x--) {
const nums = Array.from(crypto.getRandomValues(new Uint8Array(65536)).filter(n => n < 27).slice(0, 81));
nums.forEach(n => distr[n] = distr[n] ? distr[n] + 1 : 1);
}
console.log(distr);
@jimthedev
jimthedev / apollo.umd.js
Last active August 11, 2017 19:46
apollo-client 1.8 v 1.9
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('whatwg-fetch'), require('graphql/language/printer'), require('redux'), require('graphql-anywhere'), require('symbol-observable'), require('apollo-link-core')) :
typeof define === 'function' && define.amd ? define(['exports', 'whatwg-fetch', 'graphql/language/printer', 'redux', 'graphql-anywhere', 'symbol-observable', 'apollo-link-core'], factory) :
(factory((global.apollo = {}),null,global.graphql_language_printer,global.Redux,global.graphqlAnywhere,global.$$observable,global.apolloLinkCore));
}(this, (function (exports,whatwgFetch,graphql_language_printer,redux,graphqlAnywhere,$$observable,apolloLinkCore) { 'use strict';
graphqlAnywhere = graphqlAnywhere && graphqlAnywhere.hasOwnProperty('default') ? graphqlAnywhere['default'] : graphqlAnywhere;
$$observable = $$observable && $$observable.hasOwnProperty('default') ? $$observable['default'] : $$observable;
function isStringValue(value) {
@jimthedev
jimthedev / github.graphql
Created July 19, 2017 17:17
gleb's repos w/descriptions & tags
# Use this at https://developer.github.com/v4/explorer/
query {
user(login: "bahmutov") {
repositories(first: 100) {
nodes {
description
repositoryTopics(first: 100) {
nodes {
topic {
@jimthedev
jimthedev / index.js
Created June 22, 2017 01:19
An example micro service using 'micro' that installs an actual development cert to avoid browser SSL errors
const https = require('https')
const { run, send } = require('micro')
const getDevelopmentCertificate = require('devcert-san').default;
async function startServer() {
const PORT = process.env.PORT || 3443;
let ssl;
if (!process.env.NODE_ENV || process.env.NODE_ENV === 'development') {
try {
@jimthedev
jimthedev / bookmarklet.js
Created June 20, 2017 16:35
see midwestjs speakers
javascript:(function()%7B var style %3D document.createElement(%27style%27), styleContent %3D document.createTextNode(%27%23main-content>div %7B overflow-y: visible !important%3B overflow-x: visible !important%3B white-space: normal !important%3B %7D .speaker-details %7B float: inherit !important%3B overflow: visible !important%3B %7D%27)%3B style.appendChild(styleContent )%3B var caput %3D document.getElementsByTagName(%27head%27)%3B caput%5B0%5D.appendChild(style)%3B %7D)()%3B
@jimthedev
jimthedev / index.js
Last active April 20, 2017 21:12
How to extract comments out of html using Cheerio
const htmlString = `
<!doctype html>
<html lang="en" prefix="og: http://ogp.me/ns#">
<head>
<meta charset="utf-8">
<title>css</title>
<meta name="description" content="CSS parser / stringifier">
@jimthedev
jimthedev / run.sh
Created April 17, 2017 16:33
testcafe w/headless chrome canary on osx
# Assuming your tests are in test/testcafe/index.test.js
# Assumes you are using this setup: objectpartners.com/2017/04/13/how-to-install-and-use-headless-chrome-on-osx/
$(npm bin)/testcafe path:\''{"path":"/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary","cmd":"--headless --remote-debugging-port=9222 --disable-gpu"}'\' test/testcafe/index.test.js
@jimthedev
jimthedev / MinHeightView.js
Created January 30, 2017 19:10
eventually will be react-native-dims
// Note: This is a very simple example
// Typically the deviceHeight would be most useful inside of a scrollview's contentContainerStyle
// or some other view whose parent has no height itself. minheight in react native needs a parent
// to have a height.
//
import React, {Component} from 'react';
import {
Text,
View
} from 'react-native';