Skip to content

Instantly share code, notes, and snippets.

View DracoBlue's full-sized avatar

DracoBlue

View GitHub Profile
@DracoBlue
DracoBlue / Twitter To Twtxt.md
Last active March 28, 2024 12:44
Poor mans twitter to twtxt converter
@DracoBlue
DracoBlue / _respond-to.scss
Last active December 20, 2021 14:12
respond-to with multiple breakpoints and nice way to define them (in 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 / bash_exec.pp
Last active July 11, 2017 18:47
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).
define bash_exec (
$command = $name,
$user,
$creates = undef,
$cwd = undef,
$environment = undef,
$group = undef,
$logoutput = undef,
$onlyif = undef,
$path = undef,

Collection+JSON application/vnd.collection+json

{ "collection" :
  {
    "version" : "1.0",
    "href" : "http://example.org/friends/",
    
    "links" : [
 {"rel" : "feed", "href" : "http://example.org/friends/rss"}
@DracoBlue
DracoBlue / Vagrantfile
Last active December 23, 2015 17:19
A way to require specific versions for puppet modules in 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 December 16, 2015 01:49 — forked from hoffigk/my-first-goto.php
goto without goto ;)
<?php
function createFoo()
{
$pdo = new PDO(/*...*/);
$maxTryCount = 3;
$tryCount = $maxTryCount;
while ($tryCount > 0)
{
@DracoBlue
DracoBlue / API.md
Created October 1, 2012 15:25 — forked from graste/API.md
Documenting your REST API

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.

@DracoBlue
DracoBlue / agavi_override_request_method.patch
Created September 24, 2012 20:19
Override the request method in agavi, in case of a POST form.
Index: agavi/src/request/AgaviWebRequest.class.php
===================================================================
--- agavi/src/request/AgaviWebRequest.class.php (revision 4918)
+++ agavi/src/request/AgaviWebRequest.class.php (working copy)
@@ -353,7 +353,16 @@
// map REQUEST_METHOD value to a method name, or fall back to the default in $sourceDefaults.
// if someone set a static value as default for a source that does not have a mapping, then he's really asking for it, and thus out of luck
$this->setMethod($this->getParameter(sprintf('method_names[%s]', $REQUEST_METHOD), $this->getParameter(sprintf('method_names[%s]', $sourceDefaults['REQUEST_METHOD']))));
-
+
// IN
var values = {
"share_url": "http://dracoblue.net",
"share_title": "dracoblue's page",
"share_summary": "It's an awesome blog!",
"share_image_url": "http://dracoblue.net/avatar/120x120.jpg"
};
@DracoBlue
DracoBlue / agavi_json_payload.patch
Created September 17, 2012 15:58
Agavi patch to allow json payload in AgaviWebRequest + allow PATCH-method
Index: agavi/request/AgaviWebRequest.class.php
===================================================================
--- agavi/request/AgaviWebRequest.class.php (revision 1086)
+++ agavi/request/AgaviWebRequest.class.php (working copy)
@@ -343,6 +343,7 @@
$methods = array_merge(array(
'GET' => 'read',
'POST' => 'write',
+ 'PATCH' => 'patch',
'PUT' => 'create',