Skip to content

Instantly share code, notes, and snippets.

View al-the-x's full-sized avatar

David Rogers AKA "AL the X" al-the-x

View GitHub Profile
@al-the-x
al-the-x / ajax.js
Created September 30, 2015 18:03
Example of jQuery.ajax in action for TIY-Durham/2015-FALL-FEE
// globals: jQuery, $
;(function(globals){ // IIFE
/**
* Magic Tracer Bullet!
*
* Log whatever `arguments` are passed to `tracer` to the `console`
* for inspection. Great when you don't know what a callback will
* receive as inputs or aren't sure you know.
*/
@al-the-x
al-the-x / SassMeister-input-HTML.html
Created September 22, 2015 15:55
Generated by SassMeister.com.
<h1>Nested Accordion</h1>
<ul class="accordion">
<li>
<h3>Oat cake tootsie roll</h3>
<section>
<p>
Jelly sweet roll dragée gummies. Jelly-o cotton candy gingerbread. Dessert tart bear claw gummi bears I love oat cake cotton candy sesame snaps carrot cake. Croissant marshmallow tiramisu icing soufflé chocolate cake. I love pie icing. Sweet I love sweet roll cheesecake dessert. Tiramisu gingerbread I love. Muffin chocolate cake powder cheesecake oat cake tootsie roll candy soufflé. Brownie toffee powder tiramisu. Wafer I love jujubes croissant. Chocolate cake candy jujubes tootsie roll bonbon toffee I love. Topping candy jelly-o. Halvah faworki I love I love toffee pastry icing chupa chups. Pie gingerbread candy canes oat cake.
</p>
@al-the-x
al-the-x / rovarspraket.js
Created September 18, 2015 19:37
Coding Dojo @ TIY-Durham on 2015-09-18 with 2015-FALL-FEE!
var expect = require('chai').expect;
/**
* write a function `max` that takes two `Numbers` as arguments
* and returns the largest of them. HINT: Use `if-else`...!
*/
it('should calculate the max of two Number', function(){
// expect(max(1,3)).to.be.equal(3);
expect(max(2,4)).to.be.equal(4);
expect(max(2,6)).to.be.equal(6);
@al-the-x
al-the-x / rot13.js
Last active September 11, 2015 21:48
Coding Dojo for TIY-Durham FEE on 2015-09-11
var assert = require('chai').assert;
// [The ROT13 cipher](https://en.wikipedia.org/wiki/ROT13) is a simple extension
// of this idea: rotate every character in every word by _13_ places, excluding
// spaces. For example, here's a common printing phrase with ROT13 encoding:
//
// > The Quick Brown Fox Jumps Over The Lazy Dog
// > Gur Dhvpx Oebja Sbk Whzcf Bire Gur Ynml Qbt
//
// Since the English alphabet has exactly 26 characters, what happens if you
@al-the-x
al-the-x / PREZTO.md
Last active August 29, 2015 14:28
Modifications to the default installation instructions for Prezto, an amazing configuration framework for zsh by @sorin-ionescu
@al-the-x
al-the-x / pick.js
Created June 22, 2015 17:04
QUIZ: lodash.pick
function pick(object, field){
return /* FILL ME IN */
}
module.exports = pick;
@al-the-x
al-the-x / curl-listing.sh
Created June 18, 2015 20:01
Using `curl` to fetch associated data from the Etsy API...
#!/usr/bin/env zsh
curl -XGET https://openapi.etsy.com/listing/113244585.json \
--get -d api_key=REDACTED \
-d include=Variations,Images,MainImage,Shop,Shop/User
## See: https://www.etsy.com/developers/documentation/getting_started/resources#section_associations
@al-the-x
al-the-x / grid.css
Last active August 29, 2015 14:23
Using Sass `@for` and `@mixin` to build a CSS grid of 12 units
.grid {
max-width: 100%;
margin: 0 auto;
background-color: lightgrey; }
.grid .unit-span-1,
.grid .unit-1,
.grid .unit-1-12 {
width: 8.33333%;
float: left;
box-sizing: border-box; }
@al-the-x
al-the-x / between.zsh
Created June 1, 2015 19:51
Copy-pasta FU for managing files and such
between {
if [ $# -lt 1 ]; then
cat <<'USAGE'
usage: between START END
Print input from `stdin` that appears between `START`
and `END` markers, as long as they appear on a single
line.
EXAMPLE
diff --git a/ViewModeSwitch/css/styles.css b/ViewModeSwitch/css/styles.css
index 8dcc553..cb11f25 100755
--- a/ViewModeSwitch/css/styles.css
+++ b/ViewModeSwitch/css/styles.css
@@ -25,15 +25,35 @@ h3 {
#cbp-vm {
border-style: solid;
border-color: cornflowerblue;
- padding-top: 5em;
- padding-left: 5em;