This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from 'fs' | |
import sqlite3 from 'sqlite3' | |
import { open } from 'sqlite' | |
const filename = './database.db' | |
if (fs.existsSync(filename)) { | |
fs.unlinkSync(filename) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(async () => { | |
const PATH = 'https://www.instagram.com/graphql/query/' | |
const QUERY_HASHES = { | |
list: '8c2a529969ee035a5063f2fc8602a0fd', | |
post: '7d4d42b121a214d23bd43206e5142c8c' | |
} | |
const get = (query, args) => { | |
const queryParams = { query_hash: QUERY_HASHES[query], variables: JSON.stringify(args) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'date' | |
require 'json' | |
require 'net/http' | |
require 'uri' | |
# This should be your username | |
USERNAME = 'johnholdun'.freeze | |
QUERY = <<-QUERY.freeze | |
query getBooks($username: String) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'date' | |
require 'digest' | |
require 'net/http' | |
ledger = (DATA || '').each_line.map { |l| l.strip.split(' ') }.to_h | |
def url_for(token) | |
"http://stfj.net/scarcity/#{token}" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function h(tag, props = {}, children = null) { | |
if (arguments.length === 2 && props && (typeof props !== 'object' || Array.isArray(props))) { | |
children = props | |
props = {} | |
} | |
const inner = children ? [].concat(children).join('') : '' | |
if (!tag) { | |
return inner |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rest-client' | |
require 'json' | |
require 'yaml' | |
require 'opengraph_parser' | |
require 'open-uri' | |
# Generate a new Mailchimp campaign from a page one your website. I used to use | |
# this with a purpose-built template in my static site generator that | |
# automatiacally set up my most recent post as an email, just the way I liked | |
# it. You'll probably need to make some changes to suit your needs but you're |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'active_support/all' | |
require 'date' | |
require 'aws-sdk' | |
require 'pry' | |
# If you have a static website that you generate locally, track with git, and | |
# push to S3, you can use this script to incrementally push new files to your | |
# bucket. It worked for me when johnholdun.com was hosted with Amazon but use it | |
# at your own risk! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
require 'open-uri' | |
require 'upmark' | |
require 'cgi' | |
require 'uri' | |
class TootReader | |
ACTIVITY_NAMESPACE = 'http://activitystrea.ms/spec/1.0/'.freeze | |
COMMENT_TYPE = 'http://activitystrea.ms/schema/1.0/comment'.freeze |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
require 'net/https' | |
require 'uri' | |
def latest_browser_versions | |
uri = URI.parse('https://cdn.rawgit.com/Fyrd/caniuse/master/data.json') | |
http = Net::HTTP.new(uri.host, uri.port) | |
http.use_ssl = true | |
http.verify_mode = OpenSSL::SSL::VERIFY_NONE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var objectToAttributes = function (object) { | |
var output = ""; | |
var keyTranslations = { | |
className: "class", | |
htmlFor: "for" | |
}; | |
Object.keys(object).forEach(function (key) { | |
var value = object[key]; |
NewerOlder