Skip to content

Instantly share code, notes, and snippets.

View ajmalafif's full-sized avatar
💻

Ajmal Afif ajmalafif

💻
View GitHub Profile
@ajmalafif
ajmalafif / district-slate-grid-example.html
Created November 14, 2017 09:15 — forked from jonathanmoore/district-slate-grid-example.html
Example usage of Shopify's Slate grid in District
<div class="grid">
<div class="grid__item one-half medium-down--one-whole">
<p>One Half<br>
One Whole (medium down)</p>
</div>
<div class="grid__item one-half medium-down--one-whole">
<p>One Half<br>
One Whole (medium down)</p>
</div>
<div class="grid__item one-quarter large--one-half medium-down--one-whole">
@ajmalafif
ajmalafif / auto-deploy.md
Created November 7, 2017 03:53 — forked from domenic/0-github-actions.md
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with Travis

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

Create a compile script

You want a script that does a local compile to e.g. an out/ directory. Let's call this compile.sh for our purposes, but for your project it might be npm build or gulp make-docs or anything similar.

The out/ directory should contain everything you want deployed to gh-pages. That almost always includes an index.html.

Setup Work

  • Make a list of competitive/alternative services: See competitors.md file
  • Set up Google News alerts for "side project marketing" and "startup marketing".
  • Make list of blogs, subscribe to RSS feeds in Feedbin:
    • Startup marketing blogs
    • Side project blogs
    • Small business marketing blogs
    • Chicago small business/startup bloggers
  • Come up with a name and domain name

I was wrapping up 310 (Robust Production Quality Applications with Rails) after 3 busy weeks and 168 hours of work. I felt very comfortable building modest applications end-to-end and integrating with third party API's like Stripe and Twilio.

I was considering the review project I was going to build (#spaced repetition anyone?) that would encapsulate the course. As I'm reaching this point Gavin McGimpsey (we know him, we love him) posted about Ruby Rampage--a 48 hour hackathon.

Serendipity! It's always nice to outsource motivation for mundane work so you can save a portion of your willpower (AKA glucose/ketones) to stay mentally 'frosty' (we are all cognitive misers, so sayeth Nobel Psychologist Daniel Kahneman).

Plus, it was a chance to compete--iron sharpens iron and all that.

The Verdict

So how did it go? Well, I went into the weekend confident, slipped on the starting line, and failed completely. It was terrific.

@ajmalafif
ajmalafif / get-first-image.liquid
Created February 24, 2017 15:07 — forked from dominikwilkowski/get-first-image.liquid
This snippet takes HTML content from the Shopify editor and parses out the first image in all sizes.
{% comment %}
This snippet takes HTML content from the Shopify editor and parses out the first image in all sizes.
Usage:
{% include 'get-first-image' with page.content %}
Return:
{{ FirstImagePico }}
{{ FirstImageIcon }}
{{ FirstImageThumb }}

How to replace Bootstrap with Foundation for Roots/Sage

1. Clone, clean and install

  • Clone repo: git clone https://github.com/roots/sage.git
  • Remove Bootstrap: bower uninstall bootstrap-sass -S
  • Install Foundation: bower install foundation -S
  • Install NPM packages: npm install

2. Add Foundation overrides to bower.json like this:

@ajmalafif
ajmalafif / CharacterMotorC.cs
Created December 22, 2016 01:49 — forked from zephjc/CharacterMotorC.cs
Fixed C# replacements of CharacterMotor.js and FPSInputController.js via http://forum.unity3d.com/threads/93527-FPSInputController-and-CharacterMotor-in-Csharp Changes from above link: FPSInputController: Removed "Event.laddertrigger" code which is not part of the original JS file CharacterMotor: Lets the various inner properties classes show up…
using UnityEngine;
using System.Collections;
//#pragma strict
//#pragma implicit
//#pragma downcast
// Require a character controller to be attached to the same game object
// I had to initally comment out the following RequireComponent
// line to make it compile and allow attaching to my Main Camera;

Auto-Didactism: Part 1 — Principles

I want to write a bit about how I've approached learning and how to learn effectively. I don't claim to be the world's foremost expert in learning but I've generalized my process to things like:

  • Fortune 100 R&D Engineering at a global leader — (Resume)
  • Handwalking — Watch me do stairs HERE
  • Web Development — (Github)
  • Zero to Backflip in 3 hours
  • Guitar self-accompaniment for songs
  • West Coast Swing (Just started with the GF!)
@ajmalafif
ajmalafif / service-workers.md
Created August 23, 2016 05:29 — forked from Rich-Harris/service-workers.md
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.