Skip to content

Instantly share code, notes, and snippets.

View tkreis's full-sized avatar
🏁

Thomas tkreis

🏁
View GitHub Profile
@tkreis
tkreis / gist:4534822
Created January 15, 2013 00:17
merge file from different branch with current file
git checkout --merge "branch" "file"
git mergetool
@tkreis
tkreis / gist:5572396
Created May 13, 2013 23:26
rollback with capistrano
cap production deploy -S revision=58252554fab01c393dcbed846c607f36ca738ddb
@tkreis
tkreis / gist:5815752
Created June 19, 2013 16:36
fixing Zendesk POST parameter in php

When trying to get requests from the zendesk via their proxy it sends them in the following fashion:

body:{"user_id":"50","api_key":"XXX"}

PHP will have problems parsing the request header and stuffing it into the global $_POST variable. To get it to work you can use the following snippet. This returns an array, just like you would normally expect:

get_object_vars((json_decode(file_get_contents("php://input"))));
@tkreis
tkreis / HowToMaximizeGoogleHangout
Last active December 22, 2015 12:18
How to maximise Video for Google- Hangouts.
document.getElementsByClassName('Ya-sc-sa El-gg')[0].style.width="100%";
document.getElementsByClassName('Ya-sc-sa El-gg')[0].style.height="100%";
document.getElementsByClassName('Ya-sc-sa El-gg')[0].style.position="fixed";
document.getElementsByClassName('Ya-sc-sa El-gg')[0].style.top="0px";
@tkreis
tkreis / gist:5526a634f8bee6473d6b
Created December 15, 2014 23:43
slate config.
var right = slate.operation("push", {
"direction" : "right",
"style" : "bar-resize:screenSizeX/2"
});
var left = slate.operation("push", {
"direction" : "left",
"style" : "bar-resize:screenSizeX/2"
});
@tkreis
tkreis / 0_reuse_code.js
Created March 25, 2016 01:05
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@tkreis
tkreis / transformUUDI.sql
Last active July 8, 2016 19:57
Transform base64 encoded id as uuid
CREATE OR REPLACE FUNCTION decode_uuid(encoded_uuid text) RETURNS uuid AS $$
BEGIN
RETURN uuid(encode(decode((encoded_uuid || '==') ,'base64'), 'hex'));
END;
$$ LANGUAGE plpgsql;
-- usage
SELECT * from ditto_entity where id = decode_uuid('mttF0tAFSbq1of1oFNfAJw');
@tkreis
tkreis / docker-go-help.md
Created June 15, 2016 22:51
Watching and recompiling code inside of docker.
function BinarySearch() {
this.search = function (needle, haystack) {
var middle = parseInt(haystack.length/2),
compareAgainst = haystack[middle];
if(needle == compareAgainst) { return needle; }
if(needle < compareAgainst) { return this.search(needle, haystack.slice(0, middle))}
if(needle >= compareAgainst) { return this.search(needle, haystack.slice(middle))}
return false;
}
@tkreis
tkreis / index.html
Created June 10, 2017 07:39
Web component test
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>&lt;hello-world&gt;</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.5.4/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.5.4/react-dom.js"></script>
<!-- Imports polyfill -->
<script src="../webcomponentsjs/webcomponents.min.js"></script>