- This is an analysis of the code from Replacing Relay with Redux.
- code:
- Connect(CashayBook)
- -- CashayBook
- --- Connect(RecentPosts)
- ---- RecentPosts
| // ==UserScript== | |
| // @name Cleanup Twitter. | |
| // @include https://twitter.com/* | |
| // ==/UserScript== | |
| // v12: Hover over username / avatar for 100% opacity. | |
| // v13: Add link to demo. https://www.youtube.com/watch?v=07uYCbxDcqU | |
| // v14: refactor rm() and addClass() functions. Remove Messages popup at lower-right. Opacity more subtle. | |
| // Use with TamperMonkey: https://www.tampermonkey.net/ |
| // ==UserScript== | |
| // @name No Doohickey | |
| // @include https://post.news/* | |
| // ==/UserScript== | |
| var EVIL = "Can y’all repost this post to let folks know I’m on this dohicky"; | |
| var regex = RegExp( EVIL + "\\?","mg"); | |
| function makeItStop() { | |
| for (let kid of document.getElementsByTagName("p")) { | |
| var newHTML = kid.innerHTML; | |
| if (newHTML.indexOf(EVIL) > -1) { |
| return <div> | |
| <a className="resp-sharing-button__link" href={`https://facebook.com/sharer/sharer.php?u=${url}`} target="_blank" aria-label=""> | |
| <div className="resp-sharing-button resp-sharing-button--facebook resp-sharing-button--small"><div aria-hidden="true" className="resp-sharing-button__icon resp-sharing-button__icon--solid"> | |
| <svg version="1.1" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" > | |
| <g> | |
| <path d="M18.768,7.465H14.5V5.56c0-0.896,0.594-1.105,1.012-1.105s2.988,0,2.988,0V0.513L14.171,0.5C10.244,0.5,9.5,3.438,9.5,5.32 v2.145h-3v4h3c0,5.212,0,12,0,12h5c0,0,0-6.85,0-12h3.851L18.768,7.465z"/> | |
| </g> | |
| </svg> | |
| </div> | |
| </div> |
| Bookmarklet for https://gist.github.com/petehunt/ccb1b42e6608449a039b | |
| //--- As a bookmarklet: | |
| javascript:(function(){setInterval(function() { Array.prototype.slice.call(document.querySelectorAll('[data-reactid]')).forEach(function(element) { element.style.background = 'rgba(255,0,0,0.1)'; }) }, 500)})(); | |
| Logic: | |
| - Look at URL. If it's github, react-components.com, react.rocks or npmjs.com, use the last part of the URL as module name. | |
| - Else, get selected text on page as URL. | |
| - Else, ASK. | |
| - THEN: Run a Github query for uses of the module in package.json. | |
| // BOOKMARKLET | |
| javascript:(function(){ | |
| var e,t,n,r=window.getSelection().toString();r||(e=location.href.split("/"),t=e[2],r="github.com"===t||"react-components.com"==t||"react.rocks"==t||"npmjs.com"==t?e[e.length-1]:prompt("What module?")),n="https://github.com/search?utf8=%E2%9C%93&q="+r+"+filename%3Apackage+language%3AJSON&type=Code&ref=searchresults",location.href=n;})(); |
| console.clear(); | |
| var all = document.getElementsByTagName("*"); | |
| var TAGS_TO_SKIP=['BODY','HEAD','HTML','IFRAME','LABEL','LINK','NOSCRIPT','SCRIPT','STYLE','TITLE']; | |
| for (var i=0, max=all.length; i < max; i++) { | |
| var el=all[i]; | |
| if (TAGS_TO_SKIP.indexOf(el.tagName) == -1 ) { | |
| // var reactID=el.dataset.reactid; // You might want to do something with this.. | |
| console.log(i, el.tagName,el, el.getBoundingClientRect()); | |
| } |
| // Search tags for [query], find matches, return results. | |
| suggestTags(query) { | |
| query = query.trim().toLowerCase(); | |
| if (!query || query.length<2) { | |
| return null; | |
| } | |
| var goodMatches=[], partialMatches=[], allTags = db.tags; | |
| for (var x=0; x<allTags.length; ++x) { | |
| var pos=allTags[x].toLowerCase().indexOf(query); |
| # Install bower, node, rails gems. | |
| # Put this into your ~/.bash_profile | |
| function inst() { | |
| set -m # fork things in separate jobs | |
| if [ -e 'bower.json' ] | |
| then | |
| bower install & | |
| fi | |
| if [ -e 'package.json' ] |
| dataSource_DSName { | |
| dbCreate = "update" | |
| pooled = true | |
| boolean useFastLocalH2DB = true | |
| if ( useFastLocalH2DB ) { | |
| assert grails.util.Environment == grails.util.Environment.DEVELOPMENT.current, 'Only use H2 DB in Development mode!' | |
| driverClassName = "org.h2.Driver" | |
| username = "sa" | |
| password = "" |