Skip to content

Instantly share code, notes, and snippets.

@robozevel
robozevel / typehead.json
Created March 18, 2014 09:23
FQL Typehead
[
{
"uid": "keywordSELECT",
"subtext": "[FQL keyword]",
"text": "SELECT"
},
{
"uid": "keywordFROM",
"subtext": "[FQL keyword]",
"text": "FROM"
import { createElement } from '@vue/composition-api'
import htm from 'htm'
const acceptValue = ['input', 'textarea', 'option', 'select']
function getVNodeData (tag, attrs) {
const data = {}
const basics = ['slot', 'key', 'ref', 'refInFor', 'class', 'style']
const components = {
'*': 'strong',
'_': 'em',
'~': 's',
'```': 'code'
}
export default {
functional: true,
props: {
function KonamiCodeMixin (callback) {
const KEYS = ['ArrowUp', 'ArrowUp', 'ArrowDown', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'ArrowLeft', 'ArrowRight', 'KeyB', 'KeyA']
let i = 0
return {
mounted () {
window.addEventListener('keyup', this.onKeyUp)
},
destroyed () {
window.removeEventListener('keyup', this.onKeyUp)
[
[
"gbdmg",
[
[
42,
69,
59
],
[
module.exports = {
name: 'StarRating',
functional: true,
props: {
stars: {
type: Number,
default: 0
},
tag: {
type: String,
@robozevel
robozevel / esc.html
Created March 23, 2014 08:50
Stop propagation of the ESC key event when closing a file selection dialog
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<label for="uploadFile">UPLOAD</label>
<input type="file" id="uploadFile"/>
<script>
$("input[type='file']").on("keyup", function(e) {
if (e.keyCode === 27) this.blur(), e.stopPropagation();
});
$(document).on("keyup", function(e) {
(function() {
let props = $$('*')
.filter(x => Object.keys(x.dataset).length)
.reduce((o,x) => {
Object.keys(x.dataset).forEach(key => {
o[key] = key.replace(/[A-Z]/g, y => '-' + y.toLowerCase());
});
return o;
}, {});
@robozevel
robozevel / deparam.js
Last active August 19, 2016 08:40 — forked from emilisto/deparam.js
// deparam
//
// Inverse of $.param()
//
// Taken from jquery-bbq by Ben Alman
// https://github.com/cowboy/jquery-bbq/blob/master/jquery.ba-bbq.js
var isArray = Array.isArray || function(obj) {
return Object.prototype.toString.call(obj) == '[object Array]';
};