Just a dump of handy live templates I use with IntelliJ. They should also work with WebStorm.
- Go to
settings. - Search for
live templates. - Under the javascript section you should be able to manage your templates.
| window.addEventListener('DOMContentLoaded', function() { | |
| //check support | |
| if (!supportsWebGL()) { | |
| $('webgl-canvas').innerHTML = 'Your browser doesn\'t seem to support WebGL. More info <a href=\'http://get.webgl.org/\'>here</a>.'; | |
| return; | |
| } | |
| //get context | |
| var canvas = $('webgl-canvas'), | |
| gl = getWebGLContext(canvas); |
| var R = require('./ramda'); | |
| // Discussion at https://github.com/ramda/ramda/issues/1258 | |
| var namedCurry = function(fn, argNames) { | |
| // TODO: what if fn.length != argNames.length? | |
| var f = R.curryN(fn.length, function() { | |
| return fn.apply(this, arguments); | |
| }); | |
| f['secret-sauce'] = { |
| // ==UserScript== | |
| // @name Flickr Functional Suite - NEW | |
| // @namespace http://www.tilford.net/ | |
| // @description Adds some additional functionality to page | |
| // @include http://*.flickr.com/* | |
| // @include http://flickr.com/* | |
| // @include https://*.flickr.com/* | |
| // @include https://flickr.com/* | |
| // @grant GM_getValue | |
| // @grant GM_setValue |
| // ==UserScript== | |
| // @name Flickr Quick Comment (OK - Vispillo + NEW inculde https) | |
| // @description Adds a select box with pre written comments. Derived from Steeev Group Promotion Tool | |
| // @author Pierre Andrews. (code base Steeev http://steeev.f2o.org/, pt translation by Perla* <http://www.flickr.com/photos/bobnperla/>) | |
| // @namespace http://6v8.gamboni.org/ | |
| // @include http://*flickr.com/photos/* | |
| // @include https://*flickr.com/photos/* | |
| // @include http://*flickr.com/groups/*/discuss* |
| import React from 'react'; | |
| import component from 'omniscient'; | |
| import immstruct from 'immstruct'; | |
| import { compose, valueNode, partialProps } from './compose'; | |
| const data = immstruct({ counter: 0, title: 'My title' }); | |
| const em = component(({partialedTitle, children}) => | |
| <em>{partialedTitle}: {children}</em>); |
| /* | |
| * File: bst.js | |
| * | |
| * A pure JavaScript implementation of a binary search tree. | |
| * | |
| */ | |
| /* | |
| * Class: BST | |
| * |
| export const loop_raycaster = (APP) => { | |
| const cameraNative = APP.camera.getNative(); | |
| const raycaster = APP.raycaster; | |
| const ray = APP.raycaster.ray; | |
| const plane = APP.planeForRaycasting; | |
| return new WHS.Loop(() => { | |
| raycaster.setFromCamera( | |
| new THREE.Vector2( | |
| (APP.cursor.x / window.innerWidth) * 2 - 1, |
| #!/bin/bash | |
| cat $(find app/assets/stylesheets/ -type f) | | |
| grep -Eo '\.[a-z]+[a-z0-9_-]*' | sort | uniq | sed s/.// | | |
| while read CSS; do | |
| if ! grep -Erqi "([^(remove|has)]?class[(:|=|[:space:]*=>[:space:]*)]*[[:space:]\W]*[(\"|')]*[-a-z0-9[:space:]]*$CSS|\\.$CSS\b)" app/views/ vendor/assets/ app/assets/javascripts/; then | |
| echo $CSS >> unused.scss; | |
| fi | |
| done |
| import time | |
| from browsermobproxy import Server | |
| server = Server('/Users/dhunt/Downloads/browsermob-proxy-2.0-beta-6/bin/browsermob-proxy') | |
| server.start() | |
| proxy = server.create_proxy() | |
| from selenium import webdriver | |
| profile = webdriver.FirefoxProfile() | |
| profile.set_proxy(proxy.selenium_proxy()) | |
| driver = webdriver.Firefox(firefox_profile=profile) |