Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
Javascript

Kyle Hotchkiss kylehotchkiss

👨‍💻
Javascript
View GitHub Profile
@kylehotchkiss
kylehotchkiss / pagination.html
Last active May 26, 2022
Bootstrap 4 / Jekyll Pagination
View pagination.html
<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 Oct 16, 2017
Wordpress Exports to Jekyll. Fill a folder /xml/ with Wordpress exports and generate a folder /output with jekyll ready post files.
View index.js
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 Oct 10, 2017
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.
View delete.js
// 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 ) {
View keybase.md

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:

View tweets.js
var moment = require('moment');
var request = require('request');
var key = '';
var secret = '';
var token = '';
// get key
View Aeroposaux 2.txt
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,
View Aeropostaux 1.txt
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
View aeropostaux.json
This file has been truncated, but you can view the full file.
[
{
"name": "afghanistan",
"startIndex": "1886",
"endIndex": "1908",
"destinations": []
},
{
"name": "afrique du sud",
@kylehotchkiss
kylehotchkiss / textures-react-friendly.js
Last active Sep 4, 2016
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)
View textures-react-friendly.js
var textures = require('textures');
modules.export = function( texture ) {
if ( typeof texture === 'function' ) {
var svg = {
def: {},
append: function( value ) {
return this;
},
@kylehotchkiss
kylehotchkiss / rewards.js
Last active Aug 6, 2016
Chase.com Credit Cards: Get Rewards for next statement. This works on their new 2016 redesign. I don't get why they don't just show the total accumulated points in real time like Capital One does.
View rewards.js
(function() {
if ( window.location.host.indexOf('chase.com') !== -1 ) {
jQuery('.details-label').click();
alert('Calculating rewards, please wait 5 seconds for all transactions to load...')
setTimeout(function() {
var total = 0;
jQuery('[data-attr="CREDIT_ACCOUNT_ACTIVITY_ALL_TRANSACTIONS.transactions.totalTransactionRewardsEarned"]').each(function() {