Skip to content

Instantly share code, notes, and snippets.

View kshoufer's full-sized avatar

Ken Shoufer kshoufer

View GitHub Profile
@kshoufer
kshoufer / svg-shape-in-inkscape
Created July 13, 2014 01:52
Resulting code from simple shape created in Inkscape.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
@kshoufer
kshoufer / svg-in-anchor-tag
Created July 13, 2014 01:42
SVG image wrapped in an anchor tag with hover state.
HTML
<a href=”http://google.com” >
<svg class=”myCSSClass”>
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<rect x="10" y="10" height="100" width="100" style="stroke:#ff0000; fill:#0000ff"/>
</svg>
</a>
@kshoufer
kshoufer / svg-in-html
Created July 13, 2014 01:30
Two ways to insert a SVG into a HTML file.
<img src="circle.svg">
OR
<svg class=”myCSSClass”>
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<rect x="10" y="10" height="100" width="100" style="stroke:#ff0000; fill:#0000ff"/>
</svg>
@kshoufer
kshoufer / simple-svg
Created July 13, 2014 01:08
Simple SVG Shape
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<rect x="10" y="10" height="100" width="100"
style="stroke:#ff0000; fill: #0000ff"/>
</svg>
@kshoufer
kshoufer / redirect-to-subdirectory
Created May 10, 2014 20:36
redirect to subdirectory using .htaccess file
RewriteEngine on
RewriteCond %{HTTP_HOST} ^my-domain$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.my-domain/$
RewriteRule (.*) /my-directory/$1 [L]
@kshoufer
kshoufer / ajax-live-search-jquery
Last active November 2, 2015 08:57
Ajax Live Search jQuery.
$('#search').keyup(function () {
var searchField = $('#search').val();
if (searchField.length)
{
var myExp = new RegExp(searchField, "i");
var found = 0;
$.getJSON('data.json', function (data) {
var output = '<ul class="searchresults">';
@kshoufer
kshoufer / ajax-live-search-json
Created February 28, 2014 01:12
Ajax Live Search JSON.
[
{
"title": "Yahoo",
"website" : "http://yahoo.com"
},
{
"title" : "Google",
"website" : "http://google.com"
},
{
@kshoufer
kshoufer / ajax-live-search-html
Created February 28, 2014 01:09
Ajax Live Search HTML
<!DOCTYPE html>
<html>
<head>
<title>AJAX Live Search</title>
<meta charset="utf-8" />
<script src="jquery.js"></script>
<style>
.update-hidden {
display: none !important;
}
@kshoufer
kshoufer / basic-ajax-script-asynchronous
Last active August 29, 2015 13:56
Demonstration of a basic ajax script that is asynchronous.
//create the basic XMLHttpRequest object
var request;
//compatibilty check for older browsers
//check to see if an XMLHttpRequest exists. If not, it is an older Microsoft browser.
if (window.XMLHttpRequest) {
request = new XMLHttpRequest();
} else {
request = new ActiveXObject('Microsoft.XMLHTTP');
}
@kshoufer
kshoufer / basic-ajax-script-non-asynchronous
Last active August 29, 2015 13:56
Demonstration of a basic ajax script that is not asynchronous.
//create the basic XMLHttpRequest object
var request = new XMLHttpRequest();
//The HTTP requests of the XMLHttpRequest object must be initialized through the open method.
//open( Method, URL, Asynchronous, UserName, Password )
//Method - GET or POST
//URL - File name with path relative to the location of the sript file
//Asynchronous - boolean true or false
//UserName - optional
//Password - optional