Skip to content

Instantly share code, notes, and snippets.

View joshangell's full-sized avatar

Josh Angell joshangell

View GitHub Profile
@jakebellacera
jakebellacera / ICS.php
Last active April 19, 2024 09:06
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
@nedmas
nedmas / gist:1287451
Created October 14, 2011 15:40
Just a simple bash script for adding new sites on an apache server
#!/bin/bash
while getopts ":h:p:a:d:l:" opt; do
case $opt in
h)
HOST="$OPTARG"
;;
p)
PORT="$OPTARG"
;;
@seedprod
seedprod / vt_resize.php
Created November 15, 2011 14:45
Resize WordPress images on the fly vt_resize w/ multisite support
<?php
/*
* Resize images dynamically using wp built in functions
* Victor Teixeira
*
* php 5.2+
*
* Exemplo de uso:
*
* <?php
@kTmnh
kTmnh / ios6-timers.js
Last active April 27, 2022 21:24 — forked from ronkorving/ios6-timers.js
iOS6 webkit timer bug workaround
(function (window) {
// This library re-implements setTimeout, setInterval, clearTimeout, clearInterval for iOS6.
// iOS6 suffers from a bug that kills timers that are created while a page is scrolling.
// This library fixes that problem by recreating timers after scrolling finishes (with interval correction).
// This code is free to use by anyone (MIT, blabla).
// Original Author: rkorving@wizcorp.jp
var timeouts = {};
var intervals = {};
var orgSetTimeout = window.setTimeout;
var orgSetInterval = window.setInterval;
@malarkey
malarkey / Contract Killer 3.md
Last active April 16, 2024 21:44
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@pamelafox-coursera
pamelafox-coursera / CalendarHelper.class.php
Created April 10, 2013 23:09
Generate iCal files in PHP
<?php
class CalendarEvent {
/**
*
* The event ID
* @var string
*/
private $uid;
@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}
]
}]
@barneycarroll
barneycarroll / README.md
Last active August 29, 2022 12:02
Lock and unlock a page's scroll position.

jquery.scrollLock.js

Useful for when a blocking user experience is needed (in my case, didn't want people unwittingly loosing their place by scrolling while a modal required their attention): $.scrollLock() locks the body in place, preventing scroll until it is unlocked.

// Locks the page if it's currently unlocked
$.scrollLock();

// ...or vice versa
@boboldehampsink
boboldehampsink / AssetUploadPlugin.php
Last active December 26, 2015 20:49
Enable this plugin to connect <input type="file" name="fields[yourField]" /> as asset to yourField
<?php
namespace Craft;
class AssetUploadPlugin extends BasePlugin
{
function getName()
{
return Craft::t('Upload assets on the front-end');
}
@brandonkelly
brandonkelly / gist:8149062
Last active July 30, 2018 08:26
Saving new Matrix data
<?php
// Get the entry
$entry = craft()->entries->getEntryById(100);
// Convert the existing data to what it would look like in POST
$matrixData = array();
foreach ($entry->matrixField as $block)
{