Skip to content

Instantly share code, notes, and snippets.

View atomize's full-sized avatar
🎹
♩♩

Berti atomize

🎹
♩♩
View GitHub Profile
from flask import Flask, jsonify, request
from flask_cors import CORS
import usaddress
app = Flask(__name__)
CORS(app)
def addressmaker(inputarr):
newarr = []
@atomize
atomize / README-Template.md
Created August 28, 2019 22:23 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@atomize
atomize / GithubIssues.js
Last active August 19, 2019 04:02
Github Issues in React browser only
'use strict';
const Comments = ({ data }) => {
let jsx = <span class={data.comments < 1 ? "is-hidden" : "comments"}>
<i class="far fa-comment-alt"></i> {data.comments < 0 ? "" : data.comments}
</span>
return (jsx);
}
const Labels = ({ labels }) => {
@atomize
atomize / fetchProgress.js
Created August 19, 2019 01:59
get progress of fetch()
async function newguy(){
let response = await fetch('https://api.github.com/repos/javascript-tutorial/en.javascript.info/commits?per_page=100');
const reader = response.body.getReader();
// Step 2: get total length
const contentLength = +response.headers.get('Content-Length');
// Step 3: read the data
@atomize
atomize / exposeSVGDOM.js
Created July 30, 2019 19:08
Hook into an svg's dom. Note that you need to run this after the object tag has loaded (so you can trigger it with an onload function). It may require adaptation for non-svg elements.
/*
https://stackoverflow.com/a/50059015/8652537
*/
function hooksvg(elementID) { //Hook in the contentDocument of the svg so we can fire its internal scripts
var svgdoc, svgwin, returnvalue = false;
var object = (typeof elementID === 'string' ? document.getElementById(elementID) : elementID);
if (object && object.contentDocument) {
svgdoc = object.contentDocument;
}
else {
function getFlatObject(object) {
function iter(o, p) {
if (Array.isArray(o) ){
o.forEach(function (a, i) {
iter(a, p.concat(i));
});
return;
}
if (o !== null && typeof o === 'object') {
Object.keys(o).forEach(function (k) {
@atomize
atomize / Search my gists.md
Created June 5, 2019 17:41 — forked from santisbon/Search my gists.md
How to search gists

Enter this in the search box along with your search terms:

Get all gists from the user santisbon.
user:santisbon

Find all gists with a .yml extension.
extension:yml

Find all gists with HTML files. language:html

// MIT License:
//
// Copyright (c) 2010-2012, Joe Walnes
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@atomize
atomize / watchxscreensaver.pl
Created May 25, 2019 16:49
Example of how to run a shell script based on xscreensaver daemon output.
#!/usr/bin/perl
my $blanked = 0;
open (IN, "xscreensaver-command -watch |");
while (<IN>) {
if (m/^(BLANK|LOCK)/) {
if (!$blanked) {
system "sound-off";
$blanked = 1;
}
@atomize
atomize / prism-static.js
Created April 1, 2019 16:45
Static HTML generator for Prism.js highlighted sites.
const fetch = require('node-fetch');
const fs = require('fs');
const jsdom = require("jsdom");
const {
JSDOM
} = jsdom;
const argv = require('minimist')(process.argv.slice(2))
const options = {
runScripts: "dangerously",
resources: "usable",