Skip to content

Instantly share code, notes, and snippets.

Avatar
🎃
Spooky

Clark Nelson clarknelson

🎃
Spooky
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

View gist:67b08e99e858580477ba8da0ae304d99
Some notes here~
{% if relatedArticlesSelect | length == 3 %}
{% set relatedArticles = entry.relatedArticlesSelect.limit(3).all() %}
is the same as
{% set relatedArticlesSelect = entry.relatedArticlesSelect.all() %}
if you know there are only going to be three elements. dot all will fetch all of the elements attached
View example.js
var one = ['a', 'b', 'c'];
var two = ['x', 'y'];
var three = [];
var answer = ['ax', 'ay', 'bx', 'by', 'cx', 'cy'];
@clarknelson
clarknelson / reorder-on-resize.js
Created Dec 1, 2017
Reorder elements after a certain breakpoint
View reorder-on-resize.js
cmap.footer = {};
cmap.footer.checkForLayoutChange = function(){
var $footer = $('#footer'), $row = $footer.find('.row');
var $jump = $footer.find('.footer-jump-to-top');
var $pages = $footer.find('.footer-page-links');
var $social = $footer.find('.footer-social-links');
function clean(){
$jump.remove();
View a.js
$('a').each(function(){
var $foo = $(this);
});
View example.js
// store the element for later
// element === '<div>$9.99 USD/month</div>'
var $el = $(element);
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
// http://regexr.com/3h2rl
var newText = $el.text().replace('/\/month/', '<span>/month</span>');
// set the element to use the next text
$el.text(newText);
View arduino.cpp
#include <Adafruit_NeoPixel.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_LSM9DS0.h>
const float Pi = 3.14159;
Adafruit_LSM9DS0 lsm = Adafruit_LSM9DS0(1000);
#define BUTTON_PIN 10
View svg-overflow.md

Everything, all the way up to html is pushed down to here: https://clarknelson.com/drop/Screen-Shot-2017-08-08-20-10-35.png

Overflow is located in a <g> element with clip-path: https://clarknelson.com/drop/Screen-Shot-2017-08-08-19-56-57.png!

Here is what it looks like in Illustrator, it's clipped using a rectangle. You can check the generated svg in the previous img: https://clarknelson.com/drop/Screen-Shot-2017-08-08-19-59-12.png

Shifts even position: fixed elements down, like my nav: https://clarknelson.com/drop/Screen-Shot-2017-08-08-20-00-32.png

@clarknelson
clarknelson / create.js
Created Mar 9, 2017
svg header alignment
View create.js
create(){
this.beforeCreate();
var $text = this.figure.children().first();
$text.addClass('hidden');
var fontSize = Math.round(Number.parseInt($text.css('font-size')));
var text = this.canvas.text(0, 0, $text.text());
this._elements = [text];
this.group.add(text);
View assign4.lex
%{
/*-------------------------------------------------------------------------*
*--- ---*
*--- assign4.lex ---*
*--- ---*
*--- This file defines the LEX-style tokenizer for the language ---*
*--- at the bottom of page 173 of Fischer, Cytron, LeBlanc "Crafting ---*
*--- a Compiler" Addison-Wesley, 2010. ---*
*--- ---*
You can’t perform that action at this time.