Skip to content

Instantly share code, notes, and snippets.

View eristoddle's full-sized avatar

Stephan Miller eristoddle

View GitHub Profile
@eristoddle
eristoddle / EulaActivity.kt
Last active December 9, 2023 05:48
Android Generic Eula Activity
package com.eristoddle.boilerplate
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.os.Bundle
import android.text.Spanned
import androidx.appcompat.app.AppCompatActivity
import androidx.core.text.HtmlCompat
import com.google.android.material.snackbar.Snackbar
@eristoddle
eristoddle / tampermonkey.jquery.js
Created January 3, 2013 04:06
How to get jQuery to work in Chrome Tampermonkey userscripts
// ==UserScript==
// @name Vortek Preload
// @namespace vortek
// @description Load variables
// @include http://localhost/vortek_php/*
// @version 1
// ==/UserScript==
// a function that loads jQuery and calls a callback function when jQuery has finished loading
function addJQuery(callback) {
var script = document.createElement("script");
@eristoddle
eristoddle / ezinearticles.py
Created September 19, 2012 17:34
Python scrape EzineArticles.com
def get_ezinearticles(query, limit=25):
#returns 25
#TODO: Make get_goarticles and get_articlebase
def grab_article(url):
soup = BeautifulSoup.BeautifulSoup(URL(url).download())
return {"title": select(soup,"#article-title h1")[0].contents,
"body": select(soup,"#article-content")[0].contents,
"resource": select(soup,"#article-resource")[0].contents}
query = {"q":query}
soup = BeautifulSoup.BeautifulSoup(URL('http://ezinearticles.com/search/'\
@eristoddle
eristoddle / pandora-exporter.js
Created September 18, 2021 03:09
Pandora Exporter
// Need to throttle this, causes a bad network connection message
(function() {
var pageSize = 100;
var stationPageSize = 250; // IMPORTANT: This script only gets the first page of stations. If you have more than 250 this may be a problem, sorry.
var webname = location.pathname.split("/").pop(); // Seems to be a variation of the username, can be retrieved from the URL
var includeThumbsDown = true;
var allThumbs = [];
// Step one, obtain the AuthToken and CsrfToken which will allow us to make requests to the Pandora API.
@eristoddle
eristoddle / update.kt
Last active February 20, 2021 03:17
Android In-App Update
// Creates instance of the manager.
val appUpdateManager = AppUpdateManagerFactory.create(context)
// Returns an intent object that you use to check for an update.
val appUpdateInfoTask = appUpdateManager.appUpdateInfo
// Checks that the platform will allow the specified type of update.
appUpdateInfoTask.addOnSuccessListener { appUpdateInfo ->
if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
// For a flexible update, use AppUpdateType.FLEXIBLE
@eristoddle
eristoddle / phpcurl_fuck_your_cookiejar.php
Created January 31, 2014 19:12
PHP curl with cookies and no text files needed
<?php
function fetch($url, $cookies = null, $returnCookie = false) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if($cookies){
curl_setopt($ch, CURLOPT_COOKIE, implode(';',$cookies));
}
curl_setopt($ch, CURLOPT_HEADER, 1);
@eristoddle
eristoddle / g_suggest.py
Created September 19, 2012 17:36
Python Google Suggest Scraper
from urllib import quote
from string import ascii_lowercase
from operator import itemgetter
import os
import random
import requests
from datetime import datetime
from lib.languages import LANGUAGES, get_language_by_name
from lib.utils import format_timedelta
@eristoddle
eristoddle / gist:5011106
Last active July 30, 2020 14:00 — forked from stovak/gist:1343996
Add Swipe to Drupal Views Slideshow and jQuery Cycle
Drupal.settings.isTouchDevice = function() {
return "ontouchstart" in window;
}
if ( Drupal.settings.isTouchDevice() ) {
Drupal.behaviors.jQueryMobileSlideShowTouchAdvance = {
attach: function(context, settings) {
self = Drupal.behaviors.jQueryMobileSlideShowTouchAdvance;
jQuery.each(jQuery(".views_slideshow_cycle_main.viewsSlideshowCycle-processed"), function(idx, value) {
value.addEventListener("touchstart", self.handleTouchStart);
@eristoddle
eristoddle / dh_dyn_dns.py
Created August 10, 2012 20:22
Dynamic DNS Script for the Dreamhost API
#!/usr/bin/python
#Adapted from http://wiki.dreamhost.com/User:Datagrok/ddns
from dreamhostapi import DreamHostServerProxy
from os import environ
import urllib2
def main():
#Your Dreamhost API key
dh_api_key = ''
<h1>End-User License Agreement ("Agreement")</h1>
<p>Last updated: March 25, 2020</p>
<p>Please read this End-User License Agreement carefully before clicking the "I Agree" button, downloading or using Boilerplate.</p>
<h1>Interpretation and Definitions</h1>
<h2>Interpretation</h2>
<p>The words of which the initial letter is capitalized have meanings defined under the following conditions. </p>
<p>The following definitions shall have the same meaning regardless of whether they appear in singular or in plural.</p>