Skip to content

Instantly share code, notes, and snippets.

@DDynamic
DDynamic / Code.gs
Last active August 8, 2020 23:26
Politics and War GraphQL API Samples
function onOpen() {
SpreadsheetApp.getUi().createMenu("Alliance Functions").addItem("Get Members", "getMembers").addToUi();
}
function parseMember(member) {
return [member.id, member.nation_name, member.leader_name, member.score];
}
function getMembers() {
const response = UrlFetchApp.fetch("https://api.politicsandwar.com/graphql?api_key=YOURAPIKEY", {
@DDynamic
DDynamic / NonAttackingQueens.java
Last active February 16, 2020 04:09
Non Attacking Queens Template
/*
Non Attacking Queens Template
Copyright (c) 2019 Dylan Seidt <dylan.seidt@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@DDynamic
DDynamic / Vagrantfile
Last active January 14, 2019 19:38
LEMP Stack Vagrantfile on Ubuntu 18
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.network "public_network"
config.vm.provision "shell", privileged: false, path: "https://gist.githubusercontent.com/DDynamic/afd1cc378fbd470d66fd718425b3b52e/raw/provision.sh"
end
@DDynamic
DDynamic / permissions.sh
Created March 17, 2018 17:45
Websever Permissions
sudo adduser <username> www-data
sudo chown -R www-data:www-data /var/www
sudo chmod -R g+rwX /var/www
@DDynamic
DDynamic / Json.gs
Last active October 3, 2018 03:41
Google Sheets read JSON function. Read values from a JSON array in another cell using a key.
function READJSON(input, key) {
if (input.map) {
return input.map(function(input) {
return READJSON(input, key)
});
} else {
if (input || 0 !== input.length) {
var value = key.split('.').reduce(function(a, b) {
return a[b] || "";
}, JSON.parse(input));