Skip to content

Instantly share code, notes, and snippets.

cat package.json |
fx 'x => Object.entries(x.scripts).map(x => `${x[0]} ${x[1]}`).join("\n")' |
awk '{print $1 " \033[2m" $2 "\033[0m"}' |
fzf --cycle --layout reverse --height ~100% --border --info hidden --ansi \
--bind 'enter:become(npm run {1})'
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
#include <node.h>
#include <string>
using namespace v8;
void getWindows(const FunctionCallbackInfo<Value>& args) {
Isolate *isolate = args.GetIsolate();
Local<Array> winArr = Array::New(isolate);
class AnimatedOverflow extends React.Component {
render() {
const { children } = this.props
return (
<span
onMouseOver={({ target: node }) => {
const scrollDelta = node.offsetWidth - node.scrollWidth
if (scrollDelta < 0) {
const duration = 2000 * (node.scrollWidth / node.offsetWidth)
this.animation = node.animate(
const Telegraf = require('telegraf')
const webshot = require('webshot')
const fetch = require('node-fetch')
const app = new Telegraf('YOUR-KEY')
const markup = fragment => `
<!DOCTYPE html>
<html>
<head>
'.source.css':
'rgba':
'prefix': 'rgba'
'body': 'rgba(0, 0, 0, 0.5)'
'rgbaw':
'prefix': 'rgbaw'
'body': 'rgba(255, 255, 255, 0.5)'
'.source.less':
'rgba':
'prefix': 'rgba'
(new (require('atom').TextEditor)).cursors[0].constructor.prototype.isVisible = -> true

undefined

@brumm
brumm / configureStore.js
Created December 9, 2015 20:11
redux genericReducer
import {combineReducers, createStore} from "redux";
import todosActions from './actions/todos'
const genericReducer = (storeName, initialState = null, actions = {}) => {
return {
[storeName]: (state = initialState, action) => {
if (action.type === 'HYDRATE' && action.data[storeName])
return action.data[storeName]
@brumm
brumm / bookmarklet.js
Last active October 29, 2024 08:23
Find out which element is scrolling
javascript:!function() { var slice = Array.prototype.slice; function throttle(type, name, obj) { obj = obj || window; var running = false; var func = function() { if (running) { return; } running = true; requestAnimationFrame(function() { obj.dispatchEvent(new CustomEvent(name)); running = false; }); }; obj.addEventListener(type, func); } slice .call(document.querySelectorAll("*")) .filter( e => e.scrollWidth > e.offsetWidth || e.scrollHeight > e.offsetHeight ) .filter(e => { var style = window.getComputedStyle(e); return [style.overflow, style.overflowX, style.overflowY].some( e => e === "auto" || e === "scroll" ); }) .forEach(e => { var color = Math.floor(Math.random() * 16777215).toString(16); e.style.backgroundColor = "#" + color; throttle("scroll", "optimizedScroll", e); e.addEventListener("scroll", event => { console.log("%c[scroll]", "color: white; background-color:#" + color, event.target); }); }); }()