Skip to content

Instantly share code, notes, and snippets.

View hailwood's full-sized avatar

Matthew Hailwood hailwood

View GitHub Profile
@hailwood
hailwood / Get Month Bounds
Created August 9, 2013 00:19
Get the bounds for the next, and following month in php
//Get the current Month/Year
$currentMonth = date('n');
$currentYear = date('Y');
//Add one to the current month accounting for the possibility of end of year
if($currentMonth == 12){
$nextMonth = 1;
$nextYear = $currentYear+1;
} else {
$nextMonth = $currentMonth+1;
{function tree depth=0}
<li {if $active}class="active"{/if}>
<a style="margin-left:{$depth*10}px" data-needs-tooltip="true" title="{$c.category->data('page_title')}"
data-placement="left"
href="/community/blog/category/{$c.category->data('id')}/{$c.category->data('slug')}">
{$c.category->data('menu_title')}
<small class="text-muted pull-right">{$c.category->data('posts')|number_format} posts</small>
</a>
</li>
////////JAVASCRIPT////////////////////////
var scrollTimerSet = false;
var navBarIsSmall = false;
var $navBarInner = document.getElementById('header').getElementsByClassName('navbar')[0].getElementsByClassName('navbar-inner');
function getScrollTop(){
if(typeof pageYOffset!= 'undefined'){
//most browsers except IE before #9
return pageYOffset;
.dropup,
.dropdown {
position: relative;
}
.dropdown-toggle {
*margin-bottom: -3px;
}
.dropdown-toggle:active,
.open .dropdown-toggle {
outline: 0;
/* DROPDOWN CLASS DEFINITION
* ========================= */
var toggle = '[data-toggle=dropdown]'
, Dropdown = function (element) {
var $el = $(element).on('click.dropdown.data-api', this.toggle)
$('html').on('click.dropdown.data-api', function () {
$el.parent().removeClass('open')
})
}
<div class="top-account-control visible-desktop">
<div class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Welcome back, #{$writer->data('username')}!</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
<li><a tabindex="-1" href="/writer/{$writer->data('username')}"><i class="icon icon-user"></i> Writer's Profile</a></li>
<li><a tabindex="-1" href="/account"><i class="icon icon-cog"></i> Account Management</a></li>
<li class="divider"></li>
<li><a tabindex="-1" href="/logout"><i class="icon icon-signout"></i> Logout</a></li>
</ul>
@hailwood
hailwood / basic.php
Last active December 26, 2015 07:19
<!DOCTYPE HTML>
<html lang="en">
<head>
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><![endif]-->
<meta charset="utf-8">
<title>jQuery File Upload Demo - Basic version</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
<link rel="stylesheet" href="css/jquery.fileupload.css">
</head>
/var/www$ laravel new tutorial
Crafting application...
PHP Fatal error: Class 'ZipArchive' not found in phar:///usr/local/bin/laravel/src/lib/NewCommand.php on line 52
PHP Stack trace:
PHP 1. {main}() /usr/local/bin/laravel:0
PHP 2. require() /usr/local/bin/laravel:10
PHP 3. Symfony\Component\Console\Application->run() phar:///usr/local/bin/laravel/bin/craft:6
PHP 4. Symfony\Component\Console\Application->doRun() phar:///usr/local/bin/laravel/src/vendor/symfony/console/Symfony/Component/Console/Application.php:121
PHP 5. Symfony\Component\Console\Application->doRunCommand() phar:///usr/local/bin/laravel/src/vendor/symfony/console/Symfony/Component/Console/Application.php:191
PHP 6. Symfony\Component\Console\Command\Command->run() phar:///usr/local/bin/laravel/src/vendor/symfony/console/Symfony/Component/Console/Application.php:881
@if(sectionDefined('manageMenu'))
<ul class="menu">
@yield('manageMenu')
</ul>
@endif
function sectionDefined($section){
$sections = View::getSections();
return array_key_exists($section, $sections) && !empty($sections[$section]);
}