This Gist was automatically created by Carbide, a free online programming environment.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'.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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(new (require('atom').TextEditor)).cursors[0].constructor.prototype.isVisible = -> true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); }); }); }() |
NewerOlder