- Don't write all your new code on the production machine!
- Use a VCS!
- Document your functions using DocBlocks!
- Document your API (at least LIST the endpoints)... I have to decipher the meaning from your code, and that isn't really clear
- Use a single identifier as the primary ID in the API for a resource (ie don't return a list of group ids for listing groups and then expect the group name as the identifying parameter for modifying a group)
- Use a consistent model for representing the same data model in different endpoints!
- Don't concatenate fields in the API results unless there is a good reason to (e.g first name and last name)
- Don't expose the underlying database logic. This is leaky abstraction, especially when you do it inconsistently!!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$myEndpoint = \Phpoaipmh\Endpoint::build('http://WHATEVER-URL-SERVICE.com/...'); | |
foreach ($myEndpoint->listRecords('oaidc') as $item) { | |
$data = $item->metadata->children('http://www.openarchives.org/OAI/2.0/oai_dc/'); | |
$rows = $data->children('http://purl.org/dc/elements/1.1/'); | |
// .. now do whatever.. | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-----BEGIN PUBLIC KEY----- | |
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvJHIjkW9Qo+aST95YwH5 | |
dBgehdjcbacrO8TMquvHoGoa9yGHHnWmCxA2BtRoUcOPphjpY5bRVi5y179cheps | |
gmswORIFqFz8Nj0if/zOXTs+7sQ3Tq+cdtiuFM+u+ezAwWdPWgt8ZHF4BVoNpHrd | |
B4uxR8+23Ie24HAFMIsxNLI6erRrDvGvBmmv+iapyxkb/jrAb1vRjqc5Cu9Dq1aH | |
YchYhV9/Fp9dto9nZ6LG7LM0LA9pDu9eG1GavvRB7NDMyInudJyv/lbDYH0a6asJ | |
Af/aLz05NBSMtTYArJd9gZ0meYJVYCDACWPHKxsa/PXK0h9sVhXWSbKKritFLN6+ | |
/wIDAQAB | |
-----END PUBLIC KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Doctrine\ORM\Tools\Setup; | |
use Doctrine\ORM\EntityManager; | |
require_once "vendor/autoload.php"; | |
// Create a simple "default" Doctrine ORM configuration for Annotations | |
$isDevMode = true; | |
$config = Setup::createYAMLMetadataConfiguration(array(__DIR__), $isDevMode); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ContentItemMapper implements MapperInterface | |
{ | |
private $isLoaded = false; | |
// ------------------------------------------------------ | |
public function __construct(MapperCollection $mappers, IdentityMap $idMap, SplFileInfoToContentItem $transformer, $contentPath) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Need to generate passwords frequently on the Linux CLI? | |
# | |
# This script creates a password and copies it to the clipboard. | |
# | |
# 1. Ensure you have 'pwgen' and 'xclip' installed | |
# (sudo apt-get install pwgen xclip) | |
# 2. Download this script and make it executable: | |
# (sudo wget -O /usr/bin/pw https://gist.githubusercontent.com/caseyamcl/53f0c91e9ef1b42abb57/raw/pw && sudo chmod 755 /usr/bin/pw) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# ------------------------------------------------------------------- | |
# | |
# Simple HTTP Server to listen to requests from Bitbucket | |
# | |
# @author Casey McLaughlin <[email protected]> | |
# | |
# Usage: | |
# - To run the server: python server.py [/path/to/working/repo/directory] [port] [logfile] | |
# - Port is optional and defaults to 8085 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() | |
{ | |
int n, i = 3, count, c; | |
printf("Enter the number of prime numbers required\n"); | |
scanf("%d",&n); | |
if ( n >= 1 ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Need to add form elements and apply styles: | |
http://coding.smashingmagazine.com/2007/05/10/70-expert-ideas-for-better-css-coding/ | |
http://www.threestyles.com/tutorials/css-tips-for-better-typography/ | |
--> | |
<h1>This is the Example Content H1 Tag</h1> | |
<p> | |
The HTML example content is designed to provide some dummy content to help | |
you design your typography and general CSS styles, and to ensure that you've | |
accounted for <em>every single</em> HTML5 tag in your stylesheet. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Make the output directory if not exists | |
if [ ! -d /tmp/fakemail ]; | |
then | |
mkdir -p /tmp/fakemail | |
fi | |
#Create today's fakemail file | |
OUTPUTFILE=/tmp/fakemail/`date +'%F'`.txt |
NewerOlder