Skip to content

Instantly share code, notes, and snippets.

View woganmay's full-sized avatar

Wogan May woganmay

View GitHub Profile
@woganmay
woganmay / script.js
Last active February 2, 2018 22:05
Gscript for Sheets - get crypto tickers and maintain a history
// Sample workbook here:
// https://docs.google.com/spreadsheets/d/1DPASIiKJw6x0n2eq7t4xRU_FQsizBH8Z8rXOfVk2Kb4/pubhtml
// Main function - does everything
// Triggered by Google every 15 minutes
function getAllTickers() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Crypto");
// Get all tickers
@woganmay
woganmay / bloop.js
Created May 14, 2017 20:20 — forked from jlongster/bloop.js
bloop
(function() {
// Do not use this library. This is just a fun example to prove a
// point.
var Bloop = window.Bloop = {};
var mountId = 0;
function newMountId() {
return mountId++;
}
@woganmay
woganmay / listen.js
Created April 25, 2017 10:11
Subscribe to a Mastodon streaming URL with NodeJS
// npm install websocket
var WebSocketClient = require('websocket').client;
var client = new WebSocketClient();
client.on('connectFailed', function(error) {
console.log('Connect Error: ' + error.toString());
});
client.on('connect', function(connection) {
@woganmay
woganmay / download.php
Created April 23, 2017 19:42
PHP code for downloading an entire ATOM timeline
<?php
// composer require phpoffice/phpexcel
require 'vendor/autoload.php';
// Webfinger
$url = "https://wogan.im/@wogan";
/**
* Start Webfinger lookup
/*
* Instructions:
* Open Mastodon, hit F11 (or whatever brings up your console)
* Paste this and hit enter
* http://i.imgur.com/LtQ5Zk3.gifv
*/
$(function(){
// Fetch the Emojione clientside library
$.getScript("https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.7/lib/js/emojione.min.js");
@woganmay
woganmay / sample-mailable.php
Created February 19, 2017 07:30
Send basic templated email with Mailable
<?php
public function build()
{
return $this
->subject('Mail Subject')
->view('vendor.notifications.email')->with([
"level" => "default",
"greeting" => "Hi, User!",
"introLines" => [
@woganmay
woganmay / sample.php
Last active February 19, 2017 07:25
Sample MailMessage
<?php
public function toMail($notifiable)
{
return (new MailMessage)
->subject('Mail Subject')
->greeting('Hi, User!')
->line('A line before the big button')
->action('Action Button', url('/'))
@woganmay
woganmay / upload-flarum-avatar.php
Created February 12, 2017 14:03
Upload a new avatar image to Flarum
<?php
// See: https://gist.github.com/woganmay/4c15a0f7c16e41ab3a3ea1a73c595bf9
$api_url = sprintf("https://my.flarum.site/api/users/%s/avatar", $user->id);
// See: https://gist.github.com/woganmay/88f15e96fc019657a0e594366403b5cf
$token = $session->token;
$avatar_file = "/storage/avatars/1234.jpg"; // Absolute path preferred
<?php
// See: https://gist.github.com/woganmay/4c15a0f7c16e41ab3a3ea1a73c595bf9
$api_url = sprintf("https://my.flarum.site/api/users/%s/avatar", $user->id);
// See: https://gist.github.com/woganmay/88f15e96fc019657a0e594366403b5cf
$token = $session->token;
$ch = curl_init($api_url);
@woganmay
woganmay / custom-header.html
Created February 12, 2017 13:59
Modify the Flarum UI
<script type="text/javascript">
var thisHackInterval = setInterval(function(){
// Check if app is available yet
if (typeof(app) == "object")
{
// Set app routes to whatever I need
// This will repaint the DOM automatically
app.routes.settings.path = "https://my.laravel.site/preferences";