Skip to content

Instantly share code, notes, and snippets.

View phpbits's full-sized avatar
🎯
Focusing

Jeffrey Carandang phpbits

🎯
Focusing
View GitHub Profile
<?php
/**
* Insert an attachment from an URL address.
*
* @param String $url
* @param Int $parent_post_id
* @return Int Attachment ID
*/
function crb_insert_attachment_from_url($url, $parent_post_id = null) {
@phpbits
phpbits / umd-script-boilerplate.js
Created April 6, 2017 11:02 — forked from cferdinandi/umd-script-boilerplate.js
A simple boilerplate for UMD JS modules.
(function (root, factory) {
if ( typeof define === 'function' && define.amd ) {
define([], factory(root));
} else if ( typeof exports === 'object' ) {
module.exports = factory(root);
} else {
root.myPlugin = factory(root);
}
})(typeof global !== "undefined" ? global : this.window || this.global, function (root) {
@phpbits
phpbits / Hosting contract killer
Created February 27, 2016 12:00 — forked from MikeRawlins/Hosting contract killer
This is an additional paragraph for the excellent Contract Killer https://gist.github.com/malarkey/4031110
Hosting
We provide hosting for our own built websites on our preferred hosting provider <hosting provider name>.
Based on their SLA we endeavor to have 99.9% uptime on our servers measured annually.
There may of course be times when the server will not be available, this can be scheduled or unscheduled.
Scheduled downtime is when we know it is going to happen and tell you about it in advance. Scheduled downtime will wherever possible, almost certainly be outside of normal office hours. We’ll do our stuff in the evening or at weekend to minimize impact on your business.
There may be very rare occasions when we need to restart the server during normal office hours and it is not possible to inform you before hand. We don’t make these decisions lightly and if this does happen we apologise.
@phpbits
phpbits / Contract Killer 3.md
Created February 27, 2016 11:58 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: October 8th 2015
  • Original post

<?php
// Lets just pretend your content type is "Event" with machine name "event"
$node = new stdClass();
$node->type = 'event';
node_object_prepare($node);
$node->title = "My event title";
$node->language = LANGUAGE_NONE;
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="jquery.ketchup.all.min.js" type="text/javascript"></script>
</head>
<body>
<div id="email">
<span>Enter your email to sign up</span>
<form action="/subscribe.php" id="invite" method="POST">
array(
'ALABAMA'=>
array('ABBEVILLE','ADAMSVILLE','ADDISON','AKRON','ALABASTER','ALBERTVILLE','ALEXANDER CITY','ALEXANDRIA','ALICEVILLE','ALLGOOD','ALTOONA','ANDALUSIA','ANDERSON','ANNISTON','ARAB','ARDMORE','ARGO','ARITON','ARLEY','ASHFORD','ASHLAND','ASHVILLE','ATHENS','ATMORE','ATTALLA','AUBURN','AUTAUGAVILLE','AVON','BABBIE','BAILEYTON','BANKS','BAY MINETTE','BAYOU LA BATRE','BEAR CREEK','BEATRICE','BEAVERTON','BELK','BENTON','BERRY','BESSEMER','BILLINGSLEY','BIRMINGHAM','BLACK','BLOUNTSVILLE','BLUE MOUNTAIN','BLUE RIDGE','BLUE SPRINGS','BOAZ','BOLIGEE','BON AIR','BRANCHVILLE','BRANTLEY','BRENT','BREWTON','BRIDGEPORT','BRIGHTON','BRILLIANT','BROOKSIDE','BROOKWOOD','BRUNDIDGE','BUTLER','BYNUM','CAHABA HEIGHTS','CALERA','CAMDEN','CAMP HILL','CARBON HILL','CARDIFF','CAROLINA','CARROLLTON','CASTLEBERRY','CEDAR BLUFF','CENTER POINT','CENTRE','CENTREVILLE','CHALKVILLE','CHATOM','CHELSEA','CHEROKEE','CHICKASAW','CHILDERSBURG','CITRONELLE','CLANTON','CLAY','CLAYHATCHEE','CLAYTON','CLEVELAND','CLIO','COALING',