Skip to content

Instantly share code, notes, and snippets.

Adam DiCarlo adamdicarlo

Block or report user

Report or block adamdicarlo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
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
View npm-shrinkwrap.json
{
"name": "foo",
"version": "1.0.0",
"dependencies": {
"react": {
"version": "0.13.3",
"from": "react@0.13.3",
"resolved": "https://registry.npmjs.org/react/-/react-0.13.3.tgz",
"dependencies": {
"envify": {
@adamdicarlo
adamdicarlo / gist:8151450
Created Dec 27, 2013
Drupal Entity Construction Kit (ECK) code examples
View gist:8151450
/**
* Implements hook_install().
*/
function power_one_install() {
// The "generation_site" entity type already exists at this point.
// Create a new entity bundle using ECK's API.
$new_bundle = function($name, $label, $entity_type) {
$bundle = new Bundle();
$bundle->name = $name;
@adamdicarlo
adamdicarlo / karma-e2e.conf.js
Created Aug 18, 2013
Karma configs required for Karma 0.9.x+ for angular-phonecat and angular-seed. You'll need to install karma and karma-ng-scenario through npm. To install globally: `sudo npm install -g karma karma-ng-scenario` If you're using Windows, see this pull-request[1] that's more thorough than what I did here. 1. https://github.com/angular/angular-seed/p…
View karma-e2e.conf.js
// config/karma-e2e.conf.js
module.exports = function(config) {
config.set({
basePath: '../',
files: [
'test/e2e/**/*.js'
],
frameworks: ['ng-scenario'],
@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 */
You can’t perform that action at this time.