Skip to content

Instantly share code, notes, and snippets.

View radarseven's full-sized avatar

Michael Reiner radarseven

  • York, PA
View GitHub Profile
@radarseven
radarseven / README.md
Created August 1, 2017 03:57 — forked from amir-rahnama/README.md
A simple Webpack (with Dev Server) + Gulp Configuration + LiveReload + Babel to playground where you can code ES6 without the need for React

A simple Webpack + Gulpfile configuration wihtout any need for React.js that assumes you have the following project structure:

node_modules/ bower_components/ scripts/

Entry script is in scripts/entry.js

You should run gulp && gulp build-dev and you are good to go.

// Dependencies
var gulp = require('gulp'); // Gulp!
var cheerio = require('gulp-cheerio'); // Cheerio, good chap!
var filter = require('gulp-filter'); // Filter a pipeline.
var plumber = require('gulp-plumber'); // Gulp Plumber
var rename = require('gulp-rename'); // Rename
var svgstore = require('gulp-svgstore'); // Combine SVG files into one
var svgmin = require('gulp-svgmin'); // Compress SVG files
// Paths
@radarseven
radarseven / structureHelper.twig
Last active March 15, 2023 20:03
Craft CMS - Twig macro for finding position of entry in Structure section.
{# Get the position of an entry in a Structure section. #}
{% macro getEntryPosition(entry, level) %}
{% spaceless %}
{% if entry is defined and entry|length and entry.section is defined and entry.section.type == 'structure' %}
{% set siblingIds = craft.entries.section(entry.section.handle).level(level|default(2)).ids() %}
{% set position = null %}
{% for siblingId in siblingIds %}
{% if position is null %}
{% set position = siblingId == entry.id ? loop.index : null %}
{% endif %}
@radarseven
radarseven / craft-template-with-querystring-filters.twig
Last active January 11, 2017 16:44
Craft 2.x - Filtering entries in a single Twig template
{# How to handle querystring filters in a single Twig template. #}
{# Baseline entries/categories criteria. #}
{# Set any criteria here that will be relevant regardless of filters. #}
{# Section name can be array if you need to fetch from more than one section. #}
{% set criteria = {
section: ['sectionName'],
order: 'postDate desc',
limit: 9
} %}
@radarseven
radarseven / businessingBiz.js
Created August 17, 2015 19:22
How To Get Ahead in Business
var businessingBiz = (function () {
var layerMeIn = function () {
var theSignOfTheBeast = 666;
var theShrugPerson = '\u00AF'+'\\_('+'\u30C4'+')_/'+'\u00AF';
for (var i = 0; i <= theSignOfTheBeast; i++) {
alert(theShrugPerson);
}
};
@radarseven
radarseven / keybase.md
Created July 17, 2014 01:21
Keybase.io

Keybase proof

I hereby claim:

  • I am radarseven on github.
  • I am mreiner (https://keybase.io/mreiner) on keybase.
  • I have a public key whose fingerprint is 8D8A 0216 8BC3 F316 AAB4 B282 64B1 1734 D629 3694

To claim this, I am signing this object:

@radarseven
radarseven / gist:9553815
Created March 14, 2014 18:30
Craft 1.4 - Import Matrix block to entry.
<?php
/**
* Matrix Block
*/
if( isset($importEntry->post) )
{
$matrixData = array(
'pageContent' => array(
'type' => 'text',
'enabled' => true,
@radarseven
radarseven / git_archive
Created February 11, 2013 14:56
Git archiving - Add this to your .bash_profile
# Git archiving
function git_archive()
{
git archive --output="$1".zip HEAD $(git diff --name-only "$1" "$2" --stat)
}
<?php
// Dynamic paths for cross-server compatibility
$protocol = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? "https://" : "http://";
$base_url = $protocol . $_SERVER['HTTP_HOST'];
$base_path = $_SERVER['DOCUMENT_ROOT'];
$system_folder = "system";
$images_folder = "images";
$images_path = $base_path . "/" . $images_folder;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Cross-browser kerning-pairs & ligatures</title>
<style>
body { font-family: sans-serif; background: rgba(30, 10, 0, 0.05); color: rgba(40, 30, 0, 1); width: 500px; margin: 80px auto; padding: 0px; }
a { color: rgba(15, 10, 0, 0.8); text-decoration: none; border-bottom: 1px solid; padding: 1px; -webkit-transition: background 1s ease; }
a:hover { background: rgba(0, 220, 220, 0.2); }
p { line-height: 1.5; padding: 0px 1em 0em 0em; }