Skip to content

Instantly share code, notes, and snippets.

View lukeholder's full-sized avatar
👾

Luke Holder lukeholder

👾
View GitHub Profile
@lukeholder
lukeholder / install.md
Last active December 18, 2015 06:09
instructions for episode 0001 of learning your craft.

Setup your Digital Ocean droplet.

your machine:

ssh root@IP-ADDRESS

on the server:

passwd

@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 / wiki.go
Created May 28, 2013 09:07
wiki in go with markdown
// Copyright 2013 Luke Holder. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"github.com/russross/blackfriday"
"io/ioutil"
"net/http"
@lukeholder
lukeholder / ios.html
Created May 28, 2013 03:43
diable copy paste
<style type="text/css">
*:not(input,textarea) {
-webkit-touch-callout: none;
-webkit-user-select: none; /* Disable selection/Copy of UIWebView */
}
</style>
@lukeholder
lukeholder / all.rb
Created May 27, 2013 13:33
all images
all_images = Nokogiri.parse(body).css('a[href]').map { |a| a[:href] }.grep(/\.(?:png|jpg)\z/i)
all_images << Nokogiri.parse(body).css('img[src]').map { |a| a[:src] }.grep(/\.(?:png|jpg)\z/i)
@lukeholder
lukeholder / migrate.rb
Created May 27, 2013 10:20
ruby script to get at a wordpress export and put it into a sqlite db
#!/bin/env ruby
# encoding: utf-8
require 'rubygems'
require 'bundler/setup'
# require your gems as usual
require 'sequel'
require 'nokogiri'
require 'time'
@lukeholder
lukeholder / anonymous.js
Last active December 16, 2015 07:49 — forked from anonymous/anonymous.js
This script redirects all the links via blankrefer.com - except for the sites that were included in the protected_links string
//This script redirects all the links via blankrefer.com - except for the sites that were included in the protected_links string
//Example:
//var protected_links = "myspace,ebay";
var protected_links = "";
var a_to_va = 0;
var a_to_vb = 0;
var a_to_vc = "";
function blank_refer()
{
@lukeholder
lukeholder / composer.json
Last active December 15, 2015 17:59
twig in silex
{
"require": {
"silex/silex": "1.0.*@dev",
"twig/twig": ">=1.8,<2.0-dev",
"symfony/twig-bridge": "~2.1",
"monolog/monolog": ">=1.0.0"
}
}
@lukeholder
lukeholder / temp.rb
Created March 29, 2013 11:33
trying to remove the shortcode tags
#!/bin/env ruby
# encoding: utf-8
text = <<-eos
blablablablabla<p>[caption id="attachment_7055" align="alignleft" width="205"]<a href="http://tenina.com/wp-content/uploads/2013/03/Bunny-with-eggs.jpg"><img class="size-medium wp-image-7055" alt="Little egg garden…hop a long bunny!" src="http://tenina.com/wp-content/uploads/2013/03/Bunny-with-eggs-205x300.jpg" width="205" height="300" /></a> Little egg garden…hop a long bunny![/caption]</p>blablablablabla
eos
newcaptionregex = Regexp.new('\[(\w*?)(.*?)\](.*?<word>)\[\/\1\]')
text.gsub!(newcaptionregex, "\\3")
@lukeholder
lukeholder / regprob.rb
Last active December 15, 2015 13:09
reg prob
captionregex = Regexp.new('\[(\w*?)(.*?)\](.*?)\[\/\1\]')
body.gsub(captionregex, \3)