Skip to content

Instantly share code, notes, and snippets.

View leggetter's full-sized avatar

Phil Leggetter leggetter

View GitHub Profile
export async function runEveryMinute({ config, cache }) {
const res = await fetch('https://api.producthunt.com/v2/api/graphql', {
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${config.token}`
},
body: JSON.stringify({
"operationName": "GetAllTheData",
"variables": {},
"query": "query todayPosts { posts { edges { node { id name tagline votesCount } } } }" }
@jdennes
jdennes / Gemfile
Last active September 22, 2022 16:31
Export a list of members from a GitHub organisation
source "https://rubygems.org"
gem "octokit"
@olexpono
olexpono / stop_playing_R_n_B.rb
Created May 7, 2013 15:42
Inconspicuous Pusher-Powered Script
require 'logger'
require 'pusher-client'
logger = Logger.new(STDOUT)
options = {:secret => '~~~~~~~~~'}
socket = PusherClient::Socket.new('~~~~~~~~~~~', options)
# Subscribe to two channels
socket.subscribe('updates')
def getupdate
@remy
remy / weekend-commits.js
Last active January 14, 2020 08:09
Run this in the console of your github.com/<user> page (i.e. http://github.com/remy) and see how many weekends you were in front of a computer and committing code instead of taking a break.
$.getJSON('https://github.com/users/' + location.pathname.replace(/\//g, '') + '/contributions_calendar_data', weekendWork);
function weekendWork(contribs) {
var inwe = false, streak = 0, highest = 0, total = 0, possible = 0;
contribs.forEach(function (c) {
var d = new Date(c[0]).getDay();
if (d === 6) {
inwe = true;
} else if (d === 0 && inwe) {
possible++;
if (c[1] !== 0) {
// HOWTO: load LABjs itself dynamically!
// inline this code in your page to load LABjs itself dynamically, if you're so inclined.
(function (global, oDOC, handler) {
var head = oDOC.head || oDOC.getElementsByTagName("head");
function LABjsLoaded() {
// do cool stuff with $LAB here
}