Skip to content

Instantly share code, notes, and snippets.

View sdubois's full-sized avatar

Steven DuBois sdubois

View GitHub Profile
@sdubois
sdubois / gist:ee180aee9be01d42540e9cb8ad3f5bc4
Created December 5, 2024 21:06
Wix EruvStatus Image Example 2024
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<style>
img {width: 300px;}
</style>
<p id="eruvstatus"></p>
<script>
var timestamp = new Date().getTime();
$.getJSON(`https://eruvstat.us/eruv/98/json?_${timestamp}`, function(data) {
array = $.makeArray(data);
@sdubois
sdubois / gist:fbf71a2f67e327c3b5c197ca5a0998b7
Created December 5, 2024 21:05
Wix EruvStatus API Example 2024
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<p id="eruvstatus"></p>
<script>
var timestamp = new Date().getTime();
$.getJSON(`https://eruvstat.us/eruv/98/json?_${timestamp}`, function(data) {
array = $.makeArray(data);
var text = `The eruv is <strong>${array[0]['field_status']}</strong>. ${array[0]['field_status_info']}<br><br>Last updated: ${array[0]['field_date']}`;
$("#eruvstatus").html(text);
});
// This script converts the active Google Doc to HTML with custom formatting for
// the Drupal footnotes module (https://www.drupal.org/project/footnotes)
function onOpen(e) {
DocumentApp.getUi().createAddonMenu().addItem('Convert', 'ConvertGoogleDocToCleanHtml').addToUi();
}
function ConvertGoogleDocToCleanHtml() {
var body = DocumentApp.getActiveDocument().getBody();
// This script converts the active Google Doc to HTML with custom formatting for
// the Drupal footnotes module (https://www.drupal.org/project/footnotes)
function onOpen(e) {
DocumentApp.getUi().createAddonMenu().addItem('Convert', 'ConvertGoogleDocToCleanHtml').addToUi();
}
function ConvertGoogleDocToCleanHtml() {
var body = DocumentApp.getActiveDocument().getBody();
@sdubois
sdubois / ping-checker.sh
Created September 2, 2022 14:08
Monitors an IP address to see if it is accessible. Useful for uptime monitoring and testing.
#!/bin/bash
# Monitors an IP address to see if it is accessible. Useful for uptime monitoring and testing.
# Ex: bash ping-checker.sh 8.8.8.8
while true
do
ping -c1 $1 | grep -q '0 packets received' && echo 'down'
ping -c1 $1 | grep -q '1 packets received' && echo 'up'
sleep 120
done
@sdubois
sdubois / gist:abbc55ee1ba6c5ec0ae9b1115c3d5729
Created September 9, 2021 03:50
CBS Pick 'Em Random Clicker
$('#makePicks .pickContainer').each(function( index ) {
var len = $(this).find('.teamSelection').length;
var random = Math.floor( Math.random() * len ) + 1;
$(this).find('.teamSelection').eq(random-1).click();
});
@sdubois
sdubois / yes.java
Created June 4, 2011 01:56
Multithreaded "yes"
public class yes extends Thread{
static String yes;
public void run(){
for(;;){
if(yes == null){
System.out.println("y");
}
else{
System.out.println(yes);
}