Skip to content

Instantly share code, notes, and snippets.

💭
Coding hard or hardly coding

Clark Nelson clarknelson

💭
Coding hard or hardly coding
Block or report user

Report or block clarknelson

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
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. ---*
*--- ---*
View index.html
<div class="container">
<div class="slide one"></div>
<div class="slide two"></div>
<div class="slide three"></div>
<div class="slide four"></div>
</div>
View gist:8a5beb9b1f1fa29d29b3
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Bootstrap ROCKS!</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
You can’t perform that action at this time.