Skip to content

Instantly share code, notes, and snippets.

View alchemycs's full-sized avatar

alchemycs

View GitHub Profile
@alchemycs
alchemycs / Apache Configuration: Require Any
Created November 29, 2010 09:09
Sample snippet for allowing access from an IP address OR with username/password credentials
<Directory /var/www/docment.root.path>
order allow,deny
authType Basic
authName "Admin Access Only: Site is being archived"
authUserFile /var/www/HTPASSWORD
Allow from 192.168.0.1
Require valid-user
Satisfy Any
</Directory>
@alchemycs
alchemycs / shinyGradient.css
Created December 5, 2010 03:41
Adds a glassy sheen to an element
/*
Set the background-color for an element and then add the 'shinyGradient'
class to the element for a glassy shine.
*/
.shinyGradient {
background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, .8)), color-stop(.3, rgba(255,255,255, .5)), color-stop(.6, rgba(255,255,255, .3)), color-stop(.6, transparent), to(transparent) );
background-image: -moz-linear-gradient( top, rgba(255, 255, 255, .8), rgba(255, 255, 255, .5) 30%, rgba(255, 255, 255, .3) 60%, transparent 60%, transparent );
}
@alchemycs
alchemycs / stupidQuestions.html
Created December 14, 2010 01:09
Answer stupid questions easily - I get lots of dumb questions at work so I whacked this page together to stop people bothering me. Thanks to my 11yo son for the suggestion. Might clean this up later and convert it to a proper project.
<html>
<head>
<title>Stupid Questions</title>
<style>
.question {
font-size: 110%;
}
.question input[type=text] {
width: 60%;
@CHARSET "UTF-8";
/* button
---------------------------------------------- */
.button {
display: inline-block;
zoom: 1; /* zoom and *display = ie7 hack for display:inline-block */
*display: inline;
vertical-align: baseline;
margin: 0 2px;
@alchemycs
alchemycs / delete_duplicates.sql
Created January 11, 2011 23:59
Delete duplicate tuples from an entity that uses a pseudo primary key (eg, sequence/auto increment) instead of true keys
--Make a temporary table for unneeded PKs
create temporary table dirty_identifier (pseudo_key integer);
-- Get the PKs we don't need
insert into dirty_identifier (
select dt1.pseudo_pk from dirty_table as dt1, dirty_table as dt2 where
dt1.true_pk_1 = dt2.true_pk_1
-- and dt1.true_pk_2 = dt2.true_pk_3
-- and ... keep repeating for however many attributes make your real key
and dt1.pseudo_pk > dt2.pseudo_pk
);
@alchemycs
alchemycs / forms.css
Created January 17, 2011 04:41
Provides structured layout to forms
/*
Basic form layouts using fieldset/legend for form sections. Group elements such as
radio and check boxes are implemented with nested fieldsets where the legend of the nested fieldset is the question label and
labels inside the ol->li blocks label the input elements.
I'll update this gist later with better examples or a reference to examples
In the meantime email alchemist {at} alchemycs {dot} net {dot} au for examples.
*/
fieldset
{
border: 1px solid gray;
@alchemycs
alchemycs / CSFReferrer.class.php
Created April 7, 2011 03:45
Generates signed referrer links for auto-authentication into CompliSpace Fundamentals Sites
<?php
/**
* Generates signatures for referred logins to CompliSpace Fundamentals sites.
*
* Example: CSFReferrer::generate('http://xyz.complispace.com.au', 'bob',
* 'sampleAccessKeyId', 'sampleSecretAccessKey', 1320969600);
*
* @see Development Blog <http://complispace.github.com/>
* @see GitHub Repository <https://github.com/CompliSpace>
@alchemycs
alchemycs / paperpage.css
Created June 20, 2011 23:24
CSS To Simulate a Paper Page
/*
This code is taken from the forrst post: http://forrst.com/posts/CSS_to_simulate_a_paper_page-zwj
*/
section.page {
overflow: hidden;
margin: 50px auto;
width: 600px;
padding: 20px;
@alchemycs
alchemycs / blogFeed.php
Created June 21, 2011 04:58
Sample blog feed
<?php
/*
* This class pulls and caches a blog feed from a remote site and displays the content locally.
*
*/
/**
* @author Michael McHugh
* @version 1.0 2009-10-14 - Initial code
* @version 2.0 2011-06-22 - Updated to allow 0-indexed article offset and standalone display
@alchemycs
alchemycs / googleAdsDomain.xml
Created June 28, 2011 03:00
AWS Route 53 Change Resource Record Sets Request for pointing domains to google adsense domains. Now includes setting up google apps.
<?xml version="1.0" encoding="UTF-8"?>
<ChangeResourceRecordSetsRequest xmlns="https://route53.amazonaws.com/doc/2010-10-01/">
<ChangeBatch>
<Comment>
<!-- Change this comment if you like. Don't forget to fill in your own domain and publisher id below! -->
Establish DNS records for Google Ads for Domains
</Comment>
<Changes>
<Change>
<Action>CREATE</Action>