Skip to content

Instantly share code, notes, and snippets.

// ==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) {

Intro

Structure

  • Connect(CashayBook)
  • -- CashayBook
  • --- Connect(RecentPosts)
  • ---- RecentPosts
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>
@winkler1
winkler1 / gist:9a077e76839503e80ee0
Created January 20, 2015 16:03
Show React Elements
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)})();
@winkler1
winkler1 / gist:429721aa47b61f454988
Last active November 11, 2015 15:33
Find usages
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;})();
@winkler1
winkler1 / gist:027237941426b24ea151
Last active August 29, 2015 14:13
Print DOM elements, dimensions, React ID's
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' ]
@winkler1
winkler1 / gist:3656296
Created September 6, 2012 13:33
Selectively using H2 database for Grails in Datasource.groovy
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 = ""