Skip to content

Instantly share code, notes, and snippets.

Avatar

Adam DiCarlo adamdicarlo

View GitHub Profile
@adamdicarlo
adamdicarlo / generated.js
Last active Feb 7, 2017
Example of JavaScript generated from a bit of Elm code
View generated.js
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 / standardize.sh
Last active Feb 22, 2017
Convert tab-indented JS & JSX to standard
View standardize.sh
#!/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
View keybase.md

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 / FullscreenGradient.elm
Created Jun 6, 2016
Drawing a fullscreen canvas gradient in Elm 0.17
View FullscreenGradient.elm
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 / trello-card-counts.js
Last active Mar 1, 2017
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.
View trello-card-counts.js
$('.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 / d7_proximity_locations_view_makefile
Created Aug 31, 2011
Drush makefile for D7 view using proximity filter - troubleshooting
View d7_proximity_locations_view_makefile
; 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 / d7_proximity_locations_view.php
Created Aug 31, 2011
D7 view using proximity filter - troubleshooting
View d7_proximity_locations_view.php
$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 / simple-payment-create-test-payments.php
Created Oct 15, 2010
Generates a bunch of test data and inserts it into the simple_payment module's payments table.
View simple-payment-create-test-payments.php
#!/usr/bin/php
<?php
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$payment = array(
'gateway' => 'paypal',
'uid' => 0,
'nid' => 1,