Skip to content

Instantly share code, notes, and snippets.

View oliverroick's full-sized avatar

Oliver Roick oliverroick

View GitHub Profile
/* Removes items from the left-hand menu */
div[aria-label="Top Tweets off"],
[data-testid="AppTabBar_Explore_Link"],
a[href="/i/bookmarks"],
a[href$="/communities"],
[data-testid="AppTabBar_More_Menu"],
[data-testid="SideNav_NewTweet_Button"],
[data-testid="sidebarColumn"], /* right-hand "explore" column */
[data-testid="DMDrawer"], /* Messages drawer */
import React, { useState } from 'react';
function App() {
const [checked, setChecked] = useState(false);
const [consent, setConsent] = useState('');
return (
<div className="App">
<form>
<h1>Add new client</h1>
'''
Taken from:
http://stackoverflow.com/users/1074592/fakerainbrigand
http://stackoverflow.com/questions/15401815/python-simplehttpserver
'''
import sys
import os
if sys.version_info < (3,):
import SimpleHTTPServer as server
import sys
import codepoints
points = (
'\U0001F004',
'\U0001F0CF',
'\U0001F170-\U0001F171',
'\U0001F17E',
'\U0001F17F',
'\U0001F18E',
@oliverroick
oliverroick / docbox-deploy.sh
Last active January 3, 2017 19:23
Bash script to deploy Docbox documentation
#!/bin/bash
cd docs
rm -rf dddocs
rm -rf docs-build
mkdir docs-build
npm install
npm run build
git clone -b gh-pages --single-branch git@github.com:[YOUR ORG]/[YOUR REPOSITORY].git dddocs
class ResourceObjectRelatedField(serializers.RelatedField):
def to_internal_value(self, data):
return super(ResourceObjectRelatedField, self).to_internal_value(data)
def to_representation(self, value):
if isinstance(value, Organization):
serializer = OrganizationSerializer(
value,
fields=('id', 'name', 'slug'))
else:
class ResourceObjectRelatedField(serializers.RelatedField):
def to_internal_value(self, data):
return super(ResourceObjectRelatedField, self).to_internal_value(data)
def to_representation(self, value):
if isinstance(value, Organization):
serializer = OrganizationSerializer(value)
else:
raise Exception('Unexpected related object')
class ProjectSerializer(DetailSerializer, ModelSerializer):
users = UserSerializer(many=True, read_only=True)
organization = OrganizationSerializer(read_only=True)
class Meta:
model = Project
fields = ('id', 'organization', 'country', 'name', 'description',
'archived', 'urls', 'contacts', 'users')
read_only_fields = ('id', 'country',)
detail_only_fields = ('users',)
import React from 'react';
import classNames from 'classnames';
const propTypes = {
messageDismiss: React.PropTypes.func,
message: React.PropTypes.object.isRequired,
};
class Message extends React.Component {
constructor(props) {
@oliverroick
oliverroick / gist:55fbf660304f7e076f76
Last active September 24, 2015 08:45
GeoKey install instructions

Get a Debian system up and running

  1. Install vagrant and VirtualBox
  2. Create a directory where you place everything GeoKey
  3. In that directory, create a file called "Vagrantfile" and add the following:
Vagrant.configure(2) do |config|
  config.vm.box = "bento/debian-7.8"
config.vm.network "forwarded_port", guest: 8000, host: 8080