Skip to content

Instantly share code, notes, and snippets.

View kylehotchkiss's full-sized avatar
👨‍💻
Javascript

Kyle Hotchkiss kylehotchkiss

👨‍💻
Javascript
View GitHub Profile
@kylehotchkiss
kylehotchkiss / pagination.html
Last active May 26, 2022 02:39
Bootstrap 4 / Jekyll Pagination
<div class="section-pagination text-center">
<nav class="d-table mx-auto">
<ul class="pagination">
{% if paginator.previous_page %}
{% if paginator.previous_page == 1 %}
<li class="page-item"><a class="page-link" href="/blog">&laquo;</a></a>
{% else %}
<li class="page-item"><a class="page-link" href="/blog/page/{{ paginator.previous_page }}">&laquo;</a></li>
{% endif %}
{% else %}
@kylehotchkiss
kylehotchkiss / index.js
Created October 16, 2017 05:57
Wordpress Exports to Jekyll. Fill a folder /xml/ with Wordpress exports and generate a folder /output with jekyll ready post files.
var fs = require('fs');
var _ = require('lodash');
var moment = require('moment');
var parseXML = require('xml2js').parseString;
var existing = [ /* list of your current _post/* filenames, make sure all end in .html */ ]
var blacklist = [ /* list of files to exclude from output */ ];
function readFiles( dirname, onFileContent, onError ) {
fs.readdir(dirname, function( error, filenames ) {
@kylehotchkiss
kylehotchkiss / delete.js
Created October 10, 2017 00:37
Twitter bulk tweet deleter. Run in twitter console. To get a `authenticity_token`, make a tweet on twitter.com, then check network. It's in the inspector. Doesn't appear rate limited (uses twitter's internal API), but hard to tell.
// Download your archive and use the CSV to get IDs to delete.
var tweets = ["X", "Y", "Z"]
// See description about authenticity_token
(function() {
var i = 0;
var iterator = function iterator() {
if ( i < tweets.length ) {

Keybase proof

I hereby claim:

  • I am kylehotchkiss on github.
  • I am kylehotchkiss (https://keybase.io/kylehotchkiss) on keybase.
  • I have a public key whose fingerprint is 82F7 E37F 955B F22E 40F3 4A44 3E79 D4CB 80A7 8319

To claim this, I am signing this object:

@kylehotchkiss
kylehotchkiss / likecounter.js
Created November 19, 2013 04:11
A crude Instagram hashtag like calculator. Theoretically can grab up to 100,000 pics of likes (an hour), given Instagram's API throttling. It's not 100% reflective of all images in a hashtag, Instagram doesn't return full data sets. But it can report averages and project a total, if that's useful to ya. Get your own access key and try it out.
var request = require("request");
var moment = require("moment");
var access_token = '';
var getTotalLikes = function( hashtag, callback ) {
var realCount;
var totalLikes = 0;
var totalImages = 0;
var moment = require('moment');
var request = require('request');
var key = '';
var secret = '';
var token = '';
// get key
String,Translated,
62,62,
74-76),74-76),
77-98),77-98),
abidjan,Abidjan,
abidjan abjct,Abidjan,
abidjan centre nat. de tri,Abidjan,
abidjan cnt,Abidjan,
abidjan cnt-cpx,Abidjan,
abidjan cntp,Abidjan,
18
JAPON
Administrations Bureaux Pays Catégorie Bureaux Fréquences
d’origine d’échange de destination des dépêches d’échange hebdomadaires
d’origine DA/DP/CA de destination moyennes
@kylehotchkiss
kylehotchkiss / aeropostaux.json
Created December 14, 2016 01:12
ARMéNIE lol
This file has been truncated, but you can view the full file.
[
{
"name": "afghanistan",
"startIndex": "1886",
"endIndex": "1908",
"destinations": []
},
{
"name": "afrique du sud",
"startIndex": "2057",
@kylehotchkiss
kylehotchkiss / textures-react-friendly.js
Last active September 4, 2016 14:16
I wanted http://riccardoscalco.github.io/textures/ for React/SVG maps without D3 or having to react their library. Here's a hack. (React protip: generate these once outside the app lifecycle and pass them in as params - these calculations are a little slow so don't do it on every update)
var textures = require('textures');
modules.export = function( texture ) {
if ( typeof texture === 'function' ) {
var svg = {
def: {},
append: function( value ) {
return this;
},