Skip to content

Instantly share code, notes, and snippets.

View adamdicarlo's full-sized avatar

Adam DiCarlo adamdicarlo

View GitHub Profile
@adamdicarlo
adamdicarlo / simple-payment-create-test-payments.php
Created October 15, 2010 00:23
Generates a bunch of test data and inserts it into the simple_payment module's payments table.
#!/usr/bin/php
<?php
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$payment = array(
'gateway' => 'paypal',
'uid' => 0,
'nid' => 1,
@adamdicarlo
adamdicarlo / d7_proximity_locations_view.php
Created August 31, 2011 21:51
D7 view using proximity filter - troubleshooting
$view = new view;
$view->name = 'location_directory';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Location Directory';
$view->core = 7;
$view->api_version = '3.0-alpha1';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
@adamdicarlo
adamdicarlo / d7_proximity_locations_view_makefile
Created August 31, 2011 21:54
Drush makefile for D7 view using proximity filter - troubleshooting
; Relevant entries from makefile
; Geocode
projects[geocode][subdir] = "contrib"
projects[geocode][type] = "module"
projects[geocode][download][type] = "git"
projects[geocode][download][url] = "https://github.com/treehouseagency/geocode.git"
projects[geocode][download][revision] = "4f0b58b708f4b0a5ab4a"
; Geofield
@adamdicarlo
adamdicarlo / trello-card-counts.js
Last active March 1, 2017 19:35
Show card counts for each list (column) in Trello. Bonus: If you have a card with the text "PLACEHOLDER," it will show how many cards come before it, and how many come after it.
$('.list').each(function() {
var $this = $(this);
var count = $this.find('.list-card').length;
var $title = $this.find('.list-title h2');
var tester = /.*PLACEHOLDER.*/;
var placeholderIndex = false;
// Determine the index of the PLACEHOLDER card, if there is one.
$this.find('.list-card a').each(function(index, el) {
if (tester.exec($(el).text()) !== null) {
@adamdicarlo
adamdicarlo / FullscreenGradient.elm
Created June 6, 2016 05:35
Drawing a fullscreen canvas gradient in Elm 0.17
module FullscreenGradient exposing (..)
-- elm-lang/core
import Task
import Color exposing (linear, rgb)
-- elm-lang/html
import Html exposing (..)
import Html.App as Html
@adamdicarlo
adamdicarlo / keybase.md
Created June 17, 2016 17:13
Keybase proof

Keybase proof

I hereby claim:

  • I am adamdicarlo on github.
  • I am adamdicarlo (https://keybase.io/adamdicarlo) on keybase.
  • I have a public key ASA8Fak2bmPjzJiHkDf6pFz0h9NBnmPjAr0Ds8ZzoxXF7wo

To claim this, I am signing this object:

@adamdicarlo
adamdicarlo / standardize.sh
Last active February 22, 2017 17:46
Convert tab-indented JS & JSX to standard
#!/bin/bash
# assumes you have gnu find installed via homebrew (`brew install findutils --with-default-names`)
# if you installed without `--with-default-names` then use `gfind`
for f in $(/usr/local/bin/find . -regex ".*\\.jsx?" -o -path ./node_modules -prune -a -type f); do
sed -e '/\/\/ NPM/d' -i "" $f
sed -e 's/ / /g' -i "" $f
sed -e "s/return ('')/return ''/g" -i "" $f
standard --fix $f
done
@adamdicarlo
adamdicarlo / generated.js
Last active February 7, 2017 00:23
Example of JavaScript generated from a bit of Elm code
var _adamdicarlo$elm_wordy$Wordy$eligibleWord = F2(
function (word, foundWords) {
return !A2(_elm_lang$core$List$member, word, foundWords);
});
var _adamdicarlo$elm_wordy$Wordy$findUnselectedLetter = F2(
function (letters, sought) {
var predicate = function (_p0) {
var _p1 = _p0;
return _elm_lang$core$Native_Utils.eq(_p1._0, sought) && (!_p1._1);
@adamdicarlo
adamdicarlo / Bulwer-Lytton 1990s formatter bookmarklet
Last active December 17, 2022 20:00
Bulwer-Lytton 1990s pages on Wayback machine reformatter for readability
javascript:'use%20strict';void%20function(){document.body.background=%22%22,document.body.style.margin=%224em%20auto%22,document.body.style.fontSize=%2216px%22,document.body.style.maxWidth=%2250em%22;var%20a=document.createElement(%22STYLE%22);a.innerHTML=%22\n%20%20dd%20{\n%20%20%20%20font-weight:%20normal;\n%20%20%20%20margin:%201em%200%200%200;\n%20%20}\n%20%20h3%20{\n%20%20%20%20font-size:%2024px;\n%20%20%20%20margin:%203em%200%200%200;\n%20%20}\n%22,document.body.appendChild(a)}();