Skip to content

Instantly share code, notes, and snippets.

View lukeholder's full-sized avatar
👾

Luke Holder lukeholder

👾
View GitHub Profile
@lukeholder
lukeholder / html.html
Created June 11, 2013 15:05
html.html
<div class="navi-live">
<ol ui-nested-sortable="{
listType: 'ol',
items: 'li',
doNotClear: true,
placeholder: 'ui-state-highlight',
forcePlaceholderSize: true,
toleranceElement: '&gt; div'
}" ui-nested-sortable-stop="update($event, $ui)" class="navi-item-container ui-sortable"><li ya-tree="child in data.children at ol" ng-class="{minimized:child.minimized}" class="navi-item ng-scope" ng-style="getStyle(child)" style="font-weight: bold;">
<div class="nav-item-contents">
@lukeholder
lukeholder / das_download.rb
Last active October 12, 2022 01:32 — forked from itsgoingd/das_download.rb
Script to download all Destroy All Software screencasts w/ login (works as of Apr 2021)
#! /usr/bin/env ruby
# usage:
# $ das_download.rb email password
# based on various gists from this thread https://gist.github.com/maca/1798070
require "mechanize"
require "nokogiri"
require "fileutils"
class DasDownloader
@lukeholder
lukeholder / request
Created November 16, 2011 23:52
rails segment request
routes:
match '*segments' => 'RumaRequest#out'
request url:
http://rumaengine.dev/ds/dsa/dsa?fds=fds
<?php
namespace Craft;
$craft = require '../craft/app/bootstrap.php';
$craft->plugins->loadPlugins();
$productIds = craft()->elements->getCriteria('Commerce_Product', ['limit' => null])->ids();
// Configuration
@lukeholder
lukeholder / nav.twig
Last active June 20, 2018 16:53
nested navigation with in template variables.
{% set nav = [
{"href": "http://1.com", "name": "link1","sublinks":null},
{"href": "http://1.com", "name": "link2","sublinks":null},
{"href": "http://1.com", "name": "link3","sublinks":
[{"href": "http://1.com", "name": "link 3.11","sublinks":null},
{"href": "http://1.com", "name": "link 3.22","sublinks":
[{"href": "http://1.com", "name": "link 3.11","sublinks":null},
{"href": "http://1.com", "name": "link 3.22","sublinks":null}
]
}]
@lukeholder
lukeholder / import.php
Last active January 10, 2018 09:58
Basic example to import Products and their variants into Craft Commerce
<?php
namespace Craft;
// This file could be placed into your public_html folder and visited to import a cheese product.
$craft = require '../craft/app/bootstrap.php';
$craft->plugins->loadPlugins();
$newProduct = new Commerce_ProductModel();
@lukeholder
lukeholder / cart.html
Last active July 18, 2017 02:35
Cart with errors
{% extends "shop/_layouts/main" %}
{% block main %}
<div class="row">
<div class="twelve columns">
{% if cart.lineItems|length %}
<table class="u-full-width">
<thead>
<tr>
@lukeholder
lukeholder / nginxConfig
Created July 14, 2015 10:52
nginxConfig
server {
listen 80;
server_name tenina.com direct.tenina.com new.tenina.com;
# server_name .tenina.com;
root /home/forge/tenina.com/public;
rewrite /2013/12/brown-sugar-pavlova-summer-berries/ http://tenina.com/recipes/brown-sugar-pavlova-with-summer-berries permanent;
rewrite /2013/12/pomegranate-sangria/ http://tenina.com/recipes/pomegranate-sangria permanent;
rewrite /2013/12/tasmanian-salmon-pate/ http://tenina.com/recipes/tasmanian-salmon-pate permanent;
rewrite /2013/12/fruit-mince-baklava/ http://tenina.com/recipes/fruit-mince-baklava permanent;
@lukeholder
lukeholder / address.twig
Created September 14, 2016 13:12
simple address form
<form method="post">
{% set model = cart.shippingAddress %}
<input type="hidden" name="action" value="commerce/cart/updateCart">
<input type="hidden" name="redirect" value="placeyourredirecturlhere"/>
{{ getCsrfInput() }}
<div class="row">
<div class="six columns">
<label>First Name *</label>
<input type="text" id="shippingAddress-firstName" class="u-full-width" name="shippingAddress[firstName]" value="{{ model.firstName ?? "" }}">
{% set username = craft.request.getSegment(3) %}
{% set author = craft.users.username(username).first() %}
<p>Articles written by <strong>{{ author.firstName }} {{ author.lastName }}</strong></p>
{% paginate craft.entries.section('blog').limit(5).authorId(author.id) as entries %}
{% for entry in entries %}
<article>
<h1><a href="{{ entry.url }}">{{ entry.title }}</a></h1>