Skip to content

Instantly share code, notes, and snippets.

DracoBlue

Block or report user

Report or block DracoBlue

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@DracoBlue
DracoBlue / Twitter To Twtxt.md
Last active Feb 3, 2017
Poor mans twitter to twtxt converter
View Twitter To Twtxt.md
@DracoBlue
DracoBlue / 1_kid.json
Last active Aug 29, 2015
Selecting a teacher for kids HAL example
View 1_kid.json
{
"_links" : {
"self" : {"href" : "/kids/123"},
"teacher" : {"href" : "/teachers/999"},
"possible-teacher": {"href" : "/kids/123/possible-teachers"}
},
"name" : "Johnny",
"mom_phone" : "5554443333"
}
View collection_json.md

Collection+JSON application/vnd.collection+json

{ "collection" :
  {
    "version" : "1.0",
    "href" : "http://example.org/friends/",
    
    "links" : [
      {"rel" : "feed", "href" : "http://example.org/friends/rss"}
View 1_note_without_editors.json
{
"title": "Apples",
"tags": ["fruits"],
"id": "4ec92e34-34fb-47c1-a2b9-139866eb431a",
"_links": {
"self": {"href": "https://hateoas-notes.herokuapp.com/api/hal/notes/4ec92e34-34fb-47c1-a2b9-139866eb431a"},
"up": {"href": "https://hateoas-notes.herokuapp.com/api/hal/notes"},
"https://hateoas-notes.herokuapp.com/rels/owner": {
"href": "https://hateoas-notes.herokuapp.com/api/hal/users/61a4552c-d73e-4176-a912-adf404f5b6d1",
}
@DracoBlue
DracoBlue / bash_exec.pp
Last active Jul 11, 2017
Small snippet to define a bash-exec type for puppet, which launches the exec with `--login` to provide a login shell (full PATH and sourced bash files).
View bash_exec.pp
define bash_exec (
$command = $name,
$user,
$creates = undef,
$cwd = undef,
$environment = undef,
$group = undef,
$logoutput = undef,
$onlyif = undef,
$path = undef,
@DracoBlue
DracoBlue / MailQueueService.class.php
Last active Aug 29, 2015
Very simple but fast (file based) mail queue
View MailQueueService.class.php
<?php
class MailQueueService()
{
public function getMailsFolder()
{
return '/tmp/mails/';
}
public function popSpooledMail()
@DracoBlue
DracoBlue / _respond-to.scss
Last active Jan 3, 2016
respond-to with multiple breakpoints and nice way to define them (in scss)
View _respond-to.scss
@mixin respond-to($medias...) {
$breakpoints-length: length($respond-to-breakpoints);
@each $media in $medias {
$had-a-hit: false;
@for $i from 1 through $breakpoints-length {
$breakpoint: nth($respond-to-breakpoints, $i);
@if $media == nth($breakpoint, 1) {
$definition: nth($breakpoint, 2);
@DracoBlue
DracoBlue / Vagrantfile
Last active Dec 23, 2015
A way to require specific versions for puppet modules in Vagrantfile.
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
@DracoBlue
DracoBlue / my-first-goto.php
Last active Dec 16, 2015 — forked from hoffigk/my-first-goto.php
goto without goto ;)
View my-first-goto.php
<?php
function createFoo()
{
$pdo = new PDO(/*...*/);
$maxTryCount = 3;
$tryCount = $maxTryCount;
while ($tryCount > 0)
{
@DracoBlue
DracoBlue / API.md
Created Oct 1, 2012 — forked from graste/API.md
Documenting your REST API
View API.md

Hint: This is heavily based on https://gist.github.com/3428555.

Api Name

Title: METHOD URL

Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple). The request type and the URL Structure (path only, no root url). METHOD may be GET | POST | DELETE | PUT.

You can’t perform that action at this time.