Skip to content

Instantly share code, notes, and snippets.

View wshayes's full-sized avatar

William Hayes wshayes

View GitHub Profile
@Vheissu
Vheissu / PascalCaseToFileCase.js
Last active September 3, 2015 10:34
Converting a Javascript constructor name in PascalCase to file-case. Can be used with ES2015 (formerly ES6) classes to get the actual file name.
// ES2015 classes
class MyClass {
// Would return: my-class
toFileCase() {
var className = this.constructor.name.toString();
var normalised = className.replace(/((?!^)[A-Z])/g, '-$1').toLowerCase();
return normalised;
}
}
@cravecode
cravecode / Drush-7-Install.sh
Created August 3, 2011 17:08
Shell Drush Install Script
#!/bin/bash
# Update user
echo "Drush is now downloading via HTTP"
# move to home dir
cd ~
# remove current drush (if existent)
rm -rf ~/.drush/
# create drush directory (and hide it)
@barraponto
barraponto / drush_bash.sh
Created January 25, 2012 11:09
Drush Bash Tricks
# Drush-Bash tricks 0.2
# Copyright Nuvole 2010, Capi Etheriel 2012.
# License: GPL 3, see http://www.gnu.org/licenses/gpl.html
# For a quick start: copy this entire file to the end of the .bashrc
# file in your home directory and it will be enabled at your next
# login. See http://nuvole.org/node/26 for more details and options.
# Drupal and Drush aliases.
# To be added at the end of .bashrc.
@abargnesi
abargnesi / InferExactMatch_byPrefLabel.sparql
Created November 10, 2015 17:07
Infer exactMatch using case-insensitive string match on prefLabel
Select
PREFIX belv: <http://www.openbel.org/vocabulary/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX fn: <http://www.w3.org/2005/xpath-functions#>
# Bind ?namespaceConceptScheme to the URI of the namespace resource whose concepts you would like equivalenced via concept type and case-insensitive string match.
@jkmacc-LANL
jkmacc-LANL / jsonizer.py
Last active January 28, 2017 01:23
JSONVisitor
import json
from parsimonious import Grammar, NodeVisitor
class JSONVisitor(NodeVisitor):
"""
A simple JSON serializer for Parsimonious parse trees.
"""
def generic_visit(self, node, children):
@monkeyhouse
monkeyhouse / install + aurelia.json mods
Last active July 29, 2018 22:14
aurelia selectize simple custom element
npm install selectize - save
npm install jquery -save
add this to the aurelia.json file in the dependencies section of the vendor bundle
"jquery",
{
"name": "selectize",
"path": "../node_modules/selectize/dist",
import asyncio
import json
import logging
from uuid import UUID
import aio_pika
import websockets.exceptions as ws_exc
from fastapi import APIRouter, Path
from starlette import status
from starlette.websockets import WebSocket
@coldnebo
coldnebo / Default (Linux).sublime-keymap
Created August 10, 2011 23:20
simple scripts to prettify your xml and json in sublime text 2
[
{ "keys": ["ctrl+shift+x"], "command": "tidy_xml" },
{ "keys": ["ctrl+shift+j"], "command": "prettify_json" }
]
@axelav
axelav / gist:1839777
Created February 15, 2012 22:51 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@informationsea
informationsea / xgmml_networkx.py
Created December 14, 2012 12:01
XGMML importer and exporter for networkx
__author__ = "Yasunobu OKAMURA"
__copyright__ = "Copyright (c) 2012 Y.Okamura"
__license__ = "GPL v3+"
import xml.parsers.expat
import networkx as nx
class XGMMLParserHelper(object):
"""
"""