Skip to content

Instantly share code, notes, and snippets.

View rclark72's full-sized avatar

Robert Clark rclark72

View GitHub Profile

Keybase proof

I hereby claim:

  • I am lojack on github.
  • I am iojack (https://keybase.io/iojack) on keybase.
  • I have a public key ASBKEDSV4bNlFP_P1FX29s2xTY2KiYDGPt0CScDGo7ZULAo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am lojack on github.
  • I am iojack (https://keybase.io/iojack) on keybase.
  • I have a public key ASDlddhMgXLyn4iiAg3540c5uEpN-LAjN-pd5ligdGd15go

To claim this, I am signing this object:

function parseUrl(inputUrl) {
[urlPath, arguments] = inputUrl.split("?");
if(arguments) {
// Split up the arguments
}
[domain, path] = urlPath.doSomethingToParseTheUrl();
if(path) {
// Do something to the path
}
return true;
@rclark72
rclark72 / keystone.js
Created September 11, 2015 18:31
integrating postcss-middleware and sass-middleware with KeystoneJS
// Don't use Sass middleware in keystone.init()
// Load the following lines before keystone.start();
var path = require('path');
var postcssMiddleware = require('postcss-middleware');
var autoprefixer = require('autoprefixer')({ browsers: ['> 1%', 'IE 7'], cascade: false });
var sassMiddleware = require('node-sass-middleware');
keystone.app.use(sassMiddleware({
src: path.join(__dirname, 'public', 'styles'),
qs = qs.extra(select={'party_size': 'party_size_male + party_size_female'})
qs = qs.filter(Q(party_size__gt=10)|Q(party_size__lt=5))
$ docker -D start -a 62e8
[debug] stdcopy.go:88 Corrupted prefix: []
[debug] hijack.go:96 [hijack] End of stdout
Error response from daemon: Cannot start container 62e8: (exit status 2)
2014/08/05 15:24:51 Error: failed to start one or more containers
#### Old Models
class BasePage(models.Model):
title = models.CharField(max_length=2048, blank=True)
class Meta:
abstract = True
class Page(BasePage):
pass
right_alias = db.select([UserFollowing.user1_id, UserFollowing.user2_id]).alias()
left_alias = db.select([UserFollowing.user1_id, UserFollowing.user2_id]).alias()
joined_query = left_alias.join(right_alias, onclause=db.and_(right_alias.c.user1_id == left_alias.c.user2_id, right_alias.c.user2_id == left_alias.c.user1_id))
# StatementError: Not an executable clause (original cause: ArgumentError: Not an executable clause) '(SELECT user_users.user1_id AS user1_id, user_users.user2_id AS user2_id \nFROM user_users) AS anon_1 JOIN (SELECT user_users.user1_id AS user1_id, user_users.user2_id AS user2_id \nFROM user_users) AS anon_2 ON anon_2.user1_id = anon_1.user2_id AND anon_2.user2_id = anon_1.user1_id' []
# What I have
following = db.relationship('User',
secondary=UserFollowing.__table__,
primaryjoin='User.id==UserFollowing.user1_id',
secondaryjoin='User.id==UserFollowing.user2_id',
foreign_keys=[UserFollowing.user1_id, UserFollowing.user2_id],
lazy='joined')
# What I want
@rclark72
rclark72 / gist:6510214
Created September 10, 2013 14:29
this will crash IE
<!doctype html>
<html>
<head>
<title>Title</title>
<style type="text/css">
div {
border-right: 1px dotted #848484;
border-radius: 50%;
}
</style>