Skip to content

Instantly share code, notes, and snippets.

View Azerothian's full-sized avatar
♾️
Over thinking, over analyzing separates the body from the mind

Matthew Mckenzie Azerothian

♾️
Over thinking, over analyzing separates the body from the mind
View GitHub Profile
import React from "react"
export default React.createClass({
getInitialState() {
return {
displayState: "confimination",
}
},
handleButtonClick(displayState) {
return () => {
<div id="clock">
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.12.0/moment.min.js"></script>
<script>
setInterval(function() {
document.getElementById("clock").innerHTML = moment().format("YYYY/DD/MM HH:MM:ss");
})
</script>
function temp(test) {
if (test) {
return Promise.resolve("howdy");
} else {
return fetch("/api").then((response) => {
return "lol";
});
}
}
function temp(test) {
if (test) {
return Promise.resolve("howdy");
} else {
return fetch("/api").then((response) => {
return "lol";
});
}
}
@Azerothian
Azerothian / jqpromises.js
Created February 23, 2016 01:35
Even in the world of jQuery... promises rain supreme.. even if its a bastardized.
$(".feature-tab-header").on("click", function() {
var targetTab = "." + $(this).attr("id");
var targetHeader = this;
var promises = [
$(".feature-tab.active").removeClass("active").promise(),
$(".feature-tab-header").removeClass("active").promise()
];
return $.when(promises).done(function() {
$(targetHeader).addClass("active");
$(targetTab).addClass("active");
#!/bin/bash
if [ "$1" != "" ] && [ "$1" = "-h" ]; then
echo "Shipyard Deploy uses the following environment variables:"
echo " ACTION: this is the action to use (deploy, upgrade, node, remove)"
echo " DISCOVERY: discovery system used by Swarm (only if using 'node' action)"
echo " IMAGE: this overrides the default Shipyard image"
echo " PREFIX: prefix for container names"
echo " SHIPYARD_ARGS: these are passed to the Shipyard controller container as controller args"
echo " TLS_CERT_PATH: path to certs to enable TLS for Shipyard"
<scripts_config.xml checkPing="true" debugInfo="true">
<space>spaces/ocean</space>
<offlineModel>PASD010_Fletcher_1942</offlineModel>
<player entityType="Avatar" startDirection="1.0 0.0 0.0" startPosition="0.0 0.0 -313.0"/>
<cursorScaleSpeed x="40" y="40"/>
<server online="true">
<host addr="login.worldofwarships.jp:20020" alias="WOWS ASIA"/>
<host addr="login.worldofwarships.com:20020" alias="WOWS NA"/>
</server>
<chat visibleLines="6"/>
function rejectOn4(v) {
if (v === 4) {
throw "crash";
}
}
function increment(v){
return v++;
}
function demo(nmdb) {
return {
lol: () => {
return nmdb.get("blah");
}
}
}
demo(nmdb).lol().then(() => {
console.log("done");
@Azerothian
Azerothian / jsobjtogql.js
Last active May 1, 2022 04:27
Convert JS Objects to GraphQL Queries
// Babel 2015 - ES6
// Convert a complex JS Object to GraphQL Query, should handle most use cases as of 21/01/2016
const o = {
query: {
fields: {
complex: {
aliasFor: "Products",
processArgs: {
coupon: (value) => {
return `"${JSON.stringify(value).replace(/"/g, "\\\"")}"`; // passing json string as a argument