Skip to content

Instantly share code, notes, and snippets.

View alexmccabe's full-sized avatar

Alex McCabe alexmccabe

View GitHub Profile
<?php
$local_file = 'assets/info_system/rss_feeds/feed.xml';
$result = file_get_contents($local_file);
$xml = simplexml_load_string($result);
$xml->registerXPathNamespace('yweather', 'http://xml.weather.yahoo.com/ns/rss/1.0');
$location = $xml->channel->xpath('yweather:location');
if(!empty($location)) {
var navElem = '.navigation-list.top-level';
$('.toggle-mobile-nav').click(function(event) {
event.preventDefault()
$(navElem).toggle();
});
$('.top-level-item.dropdown').click(function(event) {
event.preventDefault();
console.log('clicked');
$('.level-1').hide();
(function ( $ ) {
'use strict';
$.slider = function( element, options ) {
this.options = {};
this.el = $(element);
// Public functions
this.init = function(element, options) {
var self = this;
(function () {
var apollo = {};
apollo.hasClass = function (elem, className) {
return elem.classList.contains(className);
};
apollo.addClass = function (elem, className) {
elem.classList.add(className);
<!-- The background that prevents the user from doing anything unwanted -->
<div class="overlayPanel"></div>
<!--
The modal itself
This will give you a basic modal with a fixed width
-->
<div class="modal">
<header class="modal-head">
...
/**
* Checking whether a number has the correct unit
* @var $number [number] The number (with the unit) that you want to check against. E.g 35px
* @var $unit [string] The unit that you need to know exists. E.g 'px'
* @return [boolean]
*/
@function check-unit($number, $unit) {
@if $number != '' and unit($number) == $unit {
@return true;
} @else {
@alexmccabe
alexmccabe / test.html
Last active August 29, 2015 14:09 — forked from anonymous/test.html
<!doctype html>
<html>
<head>
<style type="text/css">
</style>
</head>
<body>
<b>Returns Confirmation</b>
function generateSlug($inputString, $spacer = '-')
{
$inputString = strtolower($inputString);
$inputString = str_replace(' ', $spacer, $inputString);
$inputString = preg_replace('/[^A-Za-z0-9-]/', '', $inputString);
$inputString = str_replace($spacer.$spacer, $spacer, $inputString);
return $inputString;
}
$query = DB::table(DB::raw('
(SELECT
SupplierProduct.discontinued,
SupplierProduct.productID,
InstSupplier.*,
max(stockLevel) as stockLevel
FROM
SupplierProduct
JOIN InstSupplier ON SupplierProduct.supplierID = InstSupplier.supplierID AND InstSupplier.installationID = ? AND InstSupplier.active = 1
LEFT JOIN SupplierStock ON SupplierStock.supplierProductID = SupplierProduct.id
<?php
ini_set('max_execution_time', 600); // 10 minutes
class OptimiseImage
{
private $baseDir = '/';
private $inputDir = 'input';
private $outputDir = 'output/large';
private $tmpDir = 'tmp';