Skip to content

Instantly share code, notes, and snippets.

View junkycoder's full-sized avatar

Dan Hromada junkycoder

  • Česká republika
View GitHub Profile
@junkycoder
junkycoder / download-inline-svg-images.js
Created April 27, 2021 13:34
Download all svg icons on page
function download(filename, text, mime = 'image/svg+xml', ext = 'svg') {
var element = document.createElement('a');
element.setAttribute('href', `data:${mime};charset=utf-8, ${encodeURIComponent(text)}`);
element.setAttribute('download', `${filename}.${ext}`);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
@junkycoder
junkycoder / fix-stencil-ts.txt
Last active June 5, 2020 05:43
Fix npm start of Stencil (TypeScript issues)
$ rm ./node_modules/typescript/lib/lib.es2015.iterable.d.ts
$ touch ./node_modules/typescript/lib/lib.es2015.iterable.d.ts
$ rm ./node_modules/typescript/lib/lib.es2015.generator.d.ts
$ touch ./node_modules/typescript/lib/lib.es2015.generator.d.ts
$ npm start
@junkycoder
junkycoder / script.js
Created April 28, 2020 08:43
PayToGo Bookmark
window.open('https://app.paytogo.cz/podnik/cisterna', 'PayToGo', 'toolbar=no, menubar=no, width=420, height=600')
@junkycoder
junkycoder / Application.js
Last active November 13, 2018 09:47
Simple React Native auth factory
/**
* Usage in React Native component example
*/
import React, { Component } from 'react';
import { NavigationActions } from 'react-navigation';
import Navigator from 'app/navigators/RootNavigator';
import createAuth from './library/auth';
export default class Application extends Component {
navigator = null;
@junkycoder
junkycoder / vscode-react-patch.js
Last active September 9, 2018 11:19
Patch the `reactClassComponentPropTypes` snippet to define `propTypes` as static class property
#!/usr/bin/env node
/**
* Node.js script as patch method for vscode-react extension of 2.2.0 version.
*
* https://github.com/xabikos/vscode-react
* https://github.com/tc39/proposal-class-public-fields
*/
const fs = require('fs');
@junkycoder
junkycoder / script.js
Last active September 27, 2017 07:53
Convert CSS to JS in Marketch panel
// Can be used with Custom JavaScript for Websites
// https://chrome.google.com/webstore/detail/custom-javascript-for-web/poakhlngfciodnhlhhgnaaelnpjljija
// but is necessary to allow 'local URLs' in chrome://extensions/
if (document.title.indexOf('Marketch') === 0) {
$('.artboard').on('mouseup', () => setTimeout(init, 100));
}
function init () {
const $code = $('textarea[name="code"]');
@junkycoder
junkycoder / App.js
Created November 17, 2016 16:27
React Native Router + goToLink
import React, { Component } from 'react';
import Router from './Router';
import NewDocument from './NewDocument';
import DocumentsList from './DocumentsList';
export default class App extends Component {
@junkycoder
junkycoder / react.js
Last active November 15, 2016 09:01
concept
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
/**
* Statefull application
*/
class App extends Component {
/**
* Application state
@junkycoder
junkycoder / reboot.css
Created August 24, 2016 15:24
Bootstrap reboot.scss rewritten in pure CSS
/**
* Global styles based on Reboot.css
* http://v4-alpha.getbootstrap.com/content/reboot/
* https://github.com/twbs/bootstrap/blob/v4-dev/scss/_reboot.scss
*/
/*
Reset the box-sizing
Change from `box-sizing: content-box` to `border-box` so that when you add
@junkycoder
junkycoder / fixup_hg.sh
Last active August 10, 2016 12:25
Make mercurial_keyring work on OS X with homebrew mercurial 2.7.2.
#brew install python
#brew install mercurial
#/usr/local/bin/pip install mercurial_keyring
# patch from http://selenic.com/repo/hg/rev/e3a5922e18c3
cat <<-EOF | patch -p2 /usr/local/Cellar/mercurial/3.8.4/lib/python2.7/site-packages/mercurial/demandimport.py
diff -r 8bbe208c1812 -r e3a5922e18c3 mercurial/demandimport.py
--- a/mercurial/demandimport.py Sat Oct 05 01:02:22 2013 +0900