This file contains hidden or 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
^((?!SOME_STRING).)*$ |
This file contains hidden or 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
export default function isEventWithin(e, element) { | |
const rect = element.getBoundingClientRect() | |
return ( | |
rect.top <= e.clientY && | |
e.clientY <= rect.top + rect.height && | |
rect.left <= e.clientX && | |
e.clientX <= rect.left + rect.width | |
) | |
} |
This file contains hidden or 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
export default function copy(text) { | |
const textArea = document.createElement(`textarea`) | |
textArea.value = text | |
textArea.style.width = `2em` | |
textArea.style.height = `2em` | |
textArea.style.background = `transparent` | |
document.body.appendChild(textArea) | |
textArea.select() | |
const success = document.execCommand(`copy`) | |
document.body.removeChild(textArea) |
This file contains hidden or 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
<div ng-app="app" ng-controller="Controller as vm" directive="directive" promise="vm.promise"></div> |
This file contains hidden or 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
'use strict' | |
const serve = require('koa-static') | |
new (require('koa'))() | |
.use(serve(`${__dirname}`)) | |
.use(function* (next) { | |
return this.body = yield new Promise((resolve, reject) => { | |
require('fs').readFile(`${__dirname}/index.html`, 'utf8', | |
(err, body) => resolve(body)) |
This file contains hidden or 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
#!/bin/bash | |
alias lsfiles='for f in *; do [[ -f "$f" ]] && ls -- "$f"; done' | |
alias lsf=lsfiles |
This file contains hidden or 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
export default n => Math.random().toString(35).slice(2, !n || n >= 1097 ? 1099 : n+2) |
This file contains hidden or 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
export default { | |
/** | |
* Parse query string from path into POJO. If true is | |
* passed as 2nd argument, returns two member array | |
* of POJO and the query string portion | |
* | |
* @example | |
* ```js | |
* let path = 'http://foo.com/bar?a=1&b=2&c=3' |
This file contains hidden or 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
package my.big.fucking.package; | |
import java.io.ByteArrayOutputStream; | |
import java.io.IOException; | |
import java.util.zip.ZipEntry; | |
import java.util.zip.ZipOutputStream; | |
public class ZipHelpers { | |
/** |
This file contains hidden or 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
<!-- fix regarding function params https://www.sublimetext.com/forum/viewtopic.php?f=3&t=6211 --> | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>comment</key> | |
<string>JavaScript Syntax: version 2.0</string> | |
<key>fileTypes</key> | |
<array> | |
<string>js</string> |