Skip to content

Instantly share code, notes, and snippets.

Espen Hovlandsdal rexxars

Block or report user

Report or block rexxars

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
@rexxars
rexxars / gist:9111474
Last active Aug 29, 2015
Async.js + imboclient.js
View gist:9111474
var imbo = new Imbo.Client('host', 'pub', 'priv');
var fileInput = document.querySelector('input[type=file]');
fileInput.addEventListener('change', uploadFiles, false);
function uploadFiles() {
async.mapSeries(
fileInput.files,
imbo.addImage.bind(imbo),
onFilesUploaded
View eventCommunication.js
// In some app (say, a flickr-image-app):
appApi.emit('image-selected-for-upload', { url: someUrl, source: 'flickr' })
appApi.on('image-uploaded', function(e) {
if (e.data.source !== 'flickr') {
return;
}
alert('Image uploaded');
});
@rexxars
rexxars / gist:8ce51e1b2dec75275919
Created Aug 15, 2014
SortBy with deep object access
View gist:8ce51e1b2dec75275919
'use strict';
function deep(obj, prop) {
var segs = prop.split('.');
while (segs.length) {
obj = obj[segs.shift()];
}
return obj;
}
View gist:73862ece23195a84513c
<?php
new AuthArrayAdapter([
// Shorthand/old style access (read+write for all endpoints)
'oldPubKey' => 'oldPrivKey',
'pubKey1' => [
'someRoPrivateKey' => ['images.get', 'image.get', 'metadata.get'],
'someRwPrivateKey' => ['images.post', 'image.put', 'metadata.post']
],
View gist:452a936fcc428273ae2c
<?php
$postData = array(); // Fill this with your JSON/JS
$context = stream_context_create(array(
'http' => array(
'method' => 'POST',
'header' => 'Content-Type: application/json'. "\r\n",
'content' => json_encode($postData)
)
));
View gist:1336dead6f1f31d2c825
2 bokser kokosmelk
4 dl vann
7-8 teskjer green curry paste
1 sjalottløk
1 rødløk
3 fedd hvitløk
"En god dæsj" fiskesaus (1 ss? 2 ss?)
4 chili
1 gulerot
@rexxars
rexxars / gist:1460020
Created Dec 11, 2011 — forked from caillou/gist:1446583
Translation for relativeDate of moment.js
View gist:1460020
/*jslint white: false */
var langs;
langs = {
"de" : {
today: "heute um %time",
tomorrow: 'morgen um %time',
next: '%weekday um %time',
yesterday: 'gestern um %time',
@rexxars
rexxars / gist:1948297
Created Mar 1, 2012
Bootstrap minified
View gist:1948297
article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block;}
audio,canvas,video{display:inline-block;*display:inline;*zoom:1;}
audio:not([controls]){display:none;}
html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;}
a:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px;}
a:hover,a:active{outline:0;}
sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline;}
sup{top:-0.5em;}
sub{bottom:-0.25em;}
img{max-width:100%;height:auto;border:0;-ms-interpolation-mode:bicubic;}
@rexxars
rexxars / gist:1980516
Created Mar 5, 2012
Zend_Oauth_Client
View gist:1980516
Index: Oauth/Client.php
===================================================================
--- Oauth/Client.php (revision 43)
+++ Oauth/Client.php (working copy)
@@ -310,7 +310,8 @@
$this->getUri(true), $this->_config, $params
);
}
- if (!empty($this->paramsPost)) {
+ if (!empty($this->paramsPost) && $this->enctype != self::ENC_FORMDATA) {
@rexxars
rexxars / gist:3748547
Created Sep 19, 2012
Imbo try/catch with imageExists
View gist:3748547
<?php
$fileName = 'someImage.png';
try {
if ($imbo->imageExists($fileName)) {
$photoHash = $imbo->getImageIdentifier($fileName);
} else {
$response = $imbo->addImage($fileName);
$photoHash = $response->getImageIdentifier();
}
You can’t perform that action at this time.