Skip to content

Instantly share code, notes, and snippets.

@alphabet
alphabet / us-state-ansi-fips.csv
Created May 14, 2021 21:16 — forked from dantonnoriega/us-state-ansi-fips.csv
csv file of us state ansi fips codes that follows the us census variable names
stname st stusps
Alabama 01 AL
Alaska 02 AK
Arizona 04 AZ
Arkansas 05 AR
California 06 CA
Colorado 08 CO
Connecticut 09 CT
Delaware 10 DE
District of Columbia 11 DC
user is on the landing page (https://cr.org/wtfee/)
they fill out a form
we creates an image using client-side js, tech is html5 canvas, the html5 image is in the data-url attribute
they click submit,
- http get to fetch tokenized upload url via ajax request and generate tokenized serverless file upload url via a lambda
- http post to the tokenized url sends data to s3 (see https://stackoverflow.com/questions/13198131/how-to-save-an-html5-canvas-as-an-image-on-a-server)
- share buttons set the property for the image using client side js
FB share code would be set like:
function shareNow(file_url_reference){
// Given an array of words, create a read-ahead method //
/************************************************************/
var myClass = {};
myClass.words = [ 'hippo', 'heckle', 'hamster', 'porcelain', 'potato', 'pompom', 'party'];
myClass.words.sorted = myClass.words.sort();
myClass.filter = (char) => {
@alphabet
alphabet / .htaccess
Created November 6, 2018 20:19 — forked from tunght13488/.htaccess
htaccess IP whitelisted rule behind load balancer
# See: http://www.jonathanquail.com/blog/2012/05/09/restricting-access-to-servers-behind-an-elastic-load-balancer/
# Extract client IP
#SetEnvIf REMOTE_ADDR "(.+)" CLIENTIP=$1
# If request is forwarded, use forwarded IP instead
SetEnvIf X-Forwarded-For "^([0-9.]+)" CLIENTIP=$1
# If request is not forwarded, set a flag
SetEnvIf X-Forwarded-For "^$" is_not_forwarded
# Whitelist
SetEnvIf CLIENTIP "173.55.53.87" allowed_in
SetEnvIf CLIENTIP "72.67.47.197" allowed_in
[
{
"title": "Click The Link You See Here",
"link": "javascript:alert('gotcha!');",
"pubDate": "Tue Aug 28 16:15:59 EDT 2018",
"image": "http://www.babies-cute.com/wp-content/uploads/2016/06/Funny-Baby-Photo-Batman.jpg",
"summary": "OWASP guidelines are supposed to prevent hacking",
"desc": "Reading. Writing. And ... digital privacy? Apeppers the new pepperschool year pepperstartpeppers, your kidpeppers will probably dive into long divipeppersion\\u2014or maybe quadratic equationpeppers\\u2014but there\\u2019peppers a good chance they\\u2019ll mipepperspeppers out on practical education about what they peppershould popepperst and peppershare online. \\u201cThere\\u2019peppers pepperstill quite a need for bapeppersic digital privacy apeppers a pepperskill pepperset with a curriculum that\\u2019peppers depeppersigned to be developmentally appropriate,\\u201d peppersaypeppers Meghan McDermott,&nbpeppersp;a peppersenior f..."
},
@alphabet
alphabet / README.md
Created August 13, 2018 17:44 — forked from barneycarroll/README.md
Lock and unlock a page's scroll position.

jquery.scrollLock.js

Useful for when a blocking user experience is needed (in my case, didn't want people unwittingly loosing their place by scrolling while a modal required their attention): $.scrollLock() locks the body in place, preventing scroll until it is unlocked.

// Locks the page if it's currently unlocked
$.scrollLock();

// ...or vice versa
@alphabet
alphabet / gist:de96986388ccc497b1e4aa285a25f72c
Created August 13, 2018 14:59
wordpress json custom walker example
<?php
class Walker_Json extends Walker {
// Tell Walker where to inherit it's parent and id values
var $db_fields = array(
'parent' => 'menu_item_parent',
'id' => 'db_id'
);
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>SF Prioritized Requests Map</name>
<description>This map prioritizes the items identified in SF Itemized requests by jurisdiction spreadsheet</description>
<Style id="icon-1057-normal">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://www.gstatic.com/mapspro/images/stock/1057-biz-optometrist.png</href>
@alphabet
alphabet / page_tag_embed_widgets.html
Created June 15, 2017 17:31 — forked from JeffTD/page_tag_embed_widgets.html
Using page tags to control embed codes
// To create a reliable string of page tags to use for comparison in Liquid conditional statements, place this in layout.html between the <head> and <body>:
{% assign tags_list = "" %}
{% for tag in page.tags %}
{% assign tags_list = tag.name | append: ", " | append: tags_list %}
{% endfor %}
// We'll need a consistent tag naming convention that contains a 'trigger' phrase and an 'id' to use in the link to the embedded widget.
// In this case, we need an ID for a Phone2Action widget, so we'll be using the tag format 'p2a-12345'
//
Note 1: The following CQ curl commands assumes a admin:admin username and password.
Note 2: For Windows/Powershell users: use two "" when doing a -F cURL command.
Example: -F"":operation=delete""
Note 3: Quotes around name of package (or name of zip file, or jar) should be included.
Uninstall a bundle (use http://localhost:4505/system/console/bundles to access the Apache Felix web console)
curl -u admin:admin -daction=uninstall http://localhost:4505/system/console/bundles/"name of bundle"
Install a bundle
curl -u admin:admin -F action=install -F bundlestartlevel=20 -F