Skip to content

Instantly share code, notes, and snippets.

View robinmaben's full-sized avatar

Robin Maben robinmaben

View GitHub Profile
@robinmaben
robinmaben / request_pretty_print.py
Created June 30, 2018 00:07
print DRF-request obj as `GET path?params`
def pretty_request(request):
if not request:
return ''
params = request.query_params.__dict__.copy()
params.pop('_encoding')
params.pop('_mutable')
return '{method} {path}?{params}\n'.format(
method=request.method,
path=request.path,
@robinmaben
robinmaben / daft_autofill.js
Last active December 13, 2017 20:55
Prepare Daft.ie Form for Submission
(function() {
var agentName = $('#smi-negotiator-photo > h2').text().split(' ')[0];
var myName = 'Robin Maben';
var myEmail = '[email protected]';
var myPhoneNumb = '089 425 9823';
var alternateNumb = '089 249 3211';
var msgContent = `Hello ${agentName},
I have a critical skills work permit (previously green card). I can also provide employer and landlord references immediately if required. And also transfer deposit + rent without delay. I work in a full-time, permanent position with a global software company.
@robinmaben
robinmaben / extract_file_names_from_pull_request.js
Created November 28, 2017 11:17
Extract List of Files from Github Pull Request Diff
var extractedLinks = [];
var linkElements = document.getElementsByClassName('link-gray-dark');
for(var elem in linkElements) extractedLinks.push(linkElements[elem]);
extractedLinks.map(el => el.innerText).join('\n'); //this will print to console
@robinmaben
robinmaben / gitt.py
Last active March 15, 2017 17:52
gitt-clone
import sys
import os
DB_FILE_NAME = '../.gitt'
LINE_DELIMITER = '; '
def get_command_with_args(args):
try:
command = args[1]
@robinmaben
robinmaben / dict_utils.py
Created February 11, 2016 06:54
Flatten dictionary and then search for keys
def flatten_dict(d):
key_value_list = []
if type(d) is dict:
for key, value in d.items():
if hasattr(value, '__iter__'):
key_value_list += flatten_dict(value)
else:
key_value_list.append((key, value))
elif type(d) in [list, tuple]:
for item in d:
a, b = b, a
a = a + b
b = b - a
a = a - b
a = 5, b = 10
c = b
b = a
a = c
@robinmaben
robinmaben / react_with_jsx.html
Last active October 8, 2015 12:42
Very basic React example with in-browser JSX
<!DOCTYPE html>
<html>
<head>
<title>React JSX</title>
<script src="/build/react.js"></script>
<script src="/build/JSXTransformer.js"></script>
<script type="text/jsx">