Skip to content

Instantly share code, notes, and snippets.

@bbscout
bbscout / autocheck.js
Created June 10, 2022 11:48
Auto check invite checkbox to FB page
//First scroll through the FB Page invite list and then run this code through Developers console
//NOte: It's limited to 255 people at once
(function() {
var aa = document.querySelectorAll("div[role=checkbox]");
for (var i = 0; i < aa.length; i++){
aa[i].click();
}
})()
@bbscout
bbscout / FeatureTabletoDataframe.py
Created January 12, 2022 12:32 — forked from d-wasserman/FeatureTabletoDataframe.py
Functions to convert a ArcGIS Table/Feature Class in arcpy to a pandas dataframe. For other options, check the new ArcGIS Python API, but this works across versions.
import arcpy
import pandas as pd
def arcgis_table_to_df(in_fc, input_fields=None, query=""):
"""Function will convert an arcgis table into a pandas dataframe with an object ID index, and the selected
input fields using an arcpy.da.SearchCursor.
:param - in_fc - input feature class or table to convert
:param - input_fields - fields to input to a da search cursor for retrieval
:param - query - sql query to grab appropriate values
:returns - pandas.DataFrame"""
@bbscout
bbscout / infiniteScroll.js
Last active December 28, 2020 11:47
Infinite scroll - loading more content when reaching bottm of document (or offset from bottom)
window.onscroll = function() {
var offset = 100; //set offset from bottom
var loading = false;
var scrolledToOffset = document.documentElement.scrollTop + window.innerHeight + offset > document.documentElement.offsetHeight;
if ( scrolledToOffset && !loading ) {
function() {
loading = true; //block running function more than once before finishing previous request
//do something when reaching offset from bottom; e.g. load more content with AJAX
loading = false; //pass this in callback function when using async call
}
@bbscout
bbscout / wp-bootstrap4.1-pagination.php
Last active November 18, 2018 00:05 — forked from mtx-z/wp-bootstrap4.4-pagination.php
Wordpress Bootstrap 4.1 pagination (with custom WP_Query() and global $wp_query support)
<?php
/**
* @param WP_Query|null $wp_query
* @param bool $echo
*
* @return string
* Accepts a WP_Query instance to build pagination (for custom wp_query()),
* or nothing to use the current global $wp_query (eg: taxonomy term page)
* - Tested on WP 4.9.5