Skip to content

Instantly share code, notes, and snippets.

@rcmachado
rcmachado / jquery.unserialize.js
Created November 25, 2009 10:19
$.unserialize for jQuery
/**
* $.unserialize
*
* Takes a string in format "param1=value1&param2=value2" and returns an object { param1: 'value1', param2: 'value2' }. If the "param1" ends with "[]" the param is treated as an array.
*
* Example:
*
* Input: param1=value1&param2=value2
* Return: { param1 : value1, param2: value2 }
*
@btd
btd / jQuery.print.js
Created April 15, 2012 07:25
jQuery.print.js
// Create a jquery plugin that prints the given element.
jQuery.fn.print = function(){
// NOTE: We are trimming the jQuery collection down to the
// first element in the collection.
if (this.size() > 1){
this.eq( 0 ).print();
return;
} else if (!this.size()){
return;
}
@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;

#Discounts v1.0.0-alpha

A framework agnostic discount package featuring coupon/discount rule sets & conditions. Part of the Cartalyst Arsenal & licensed OSI BSD 3. Code well, rock on.

##Package Story

History and future capabilities.

####Incomplete

  • Discount::add(...) Can create a discount.
@jonathanhirz
jonathanhirz / timestamp.py
Last active December 28, 2015 13:29
Sublime Text 2 Plugin: Timestamp for creation date and last modified date, automatically added and updated.
"""
Automatically add and update time stamps in your files.
On file open, will replace [timeStamp] with the current date and time.
Currently looks for two instances of this (example below).
To use, place the text [timeStamp] in your template file where you want it.
ex.
// CREATED: timeStamp
// MODIFIED: timeStamp
@gosukiwi
gosukiwi / paginator.inc.php
Last active January 24, 2022 09:39
PHP Pagination generator
<?php
/**
* Pagination generator
*/
class Pagination
{
private $items_per_page = 0;
private $items_total = 0;
private $mid_range = 7;
private $page_name = 'page';
@umrysh
umrysh / mailgun-webhook.php
Created January 29, 2015 23:11
Very simple PHP webhook for Mailgun that emails you on errors.
<?php
$key = "<API Key>";
$from = "info@example.com";
$to = "dave@example.com";
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if(isset($_POST['timestamp']) && isset($_POST['token']) && isset($_POST['signature']) && hash_hmac('sha256', $_POST['timestamp'] . $_POST['token'], $key) === $_POST['signature'])
{
if($_POST['event'] == 'complained') {
@heathdutton
heathdutton / upgrade-php7.sh
Last active January 12, 2024 07:47
Upgrade PHP to 7.3 on Amazon Linux (specifically for Elastic Beanstalk but should work elsewhere)
#!/usr/bin/env bash
# Upgrade an Amazon Linux EC2 to PHP 7.3
#
# Last tested w/ PHP 7.2 AWS Linux version 2.8.5
#
# Must be ran as sudo:
# sudo bash upgrade-php7.sh
#
# Can be added to ./.ebextensions/20_php.config like so:
# container_commands:
@bobmurdoch
bobmurdoch / tailwind_color_variables.scss
Created October 8, 2018 20:26
Tailwind CSS colors as Sass variables
$black: #22292f;
$grey-darkest: #3d4852;
$grey-darker: #606f7b;
$grey-dark: #8795a1;
$grey: #b8c2cc;
$grey-light: #dae1e7;
$grey-lighter: #f1f5f8;
$grey-lightest: #f8fafc;
$white: #fff;
$red-darkest : #3b0d0c;
@michaelroper
michaelroper / tailwind-palettte-app.json
Last active January 19, 2024 23:19
Tailwind CSS default colors in Palettte.app's JSON format
[
{
"paletteName": "gray",
"swatches": [
{
"name": "100",
"color": "#f7fafc"
},
{
"name": "200",