Skip to content

Instantly share code, notes, and snippets.

View Bockit's full-sized avatar

James Hiscock Bockit

  • Sydney, Australia
View GitHub Profile

Keybase proof

I hereby claim:

  • I am bockit on github.
  • I am bockit (https://keybase.io/bockit) on keybase.
  • I have a public key whose fingerprint is 8BFC D654 DE74 F85D 23E4 A199 FFE9 5DAC BA99 CB0F

To claim this, I am signing this object:

@Bockit
Bockit / component-child.jsx
Created February 28, 2015 11:04
Context exploration
var React = require('react')
var Message = require('sub-component/message')
class Component extends React.Component {
getChildContext () {
return {
message: this.props.foo
}
}
@Bockit
Bockit / SassMeister-input.scss
Created October 21, 2015 04:22
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
.full-screen-nav {
font-size: 12px;
// .full-screen-nav-inner
&-inner {
font-size: 12px;
# Only compile sass per request by default, compiling requirejs is too heavy
PIPELINE_COMPILERS = (
'pipeline.compilers.sass.SASSCompiler',
)
# Path to your sass binary and any extra arguments you want to add
# We add compass to get access to their wonderful sass extentions
PIPELINE_SASS_BINARY = '/usr/bin/sass'
PIPELINE_SASS_ARGUMENTS = '--compass'
# Dict of discreet CSS files to have
# Only compile sass per request by default, compiling requirejs is too heavy
PIPELINE_COMPILERS = (
'pipeline.compilers.sass.SASSCompiler',
)
# Path to your sass binary and any extra arguments you want to add
# We add compass to get access to their wonderful sass extentions
PIPELINE_SASS_BINARY = '/usr/bin/sass'
PIPELINE_SASS_ARGUMENTS = '--compass'
# Dict of discreet CSS files to have
@Bockit
Bockit / synclabels.py
Last active December 18, 2015 13:59
Simple script to sync labels to any repository. Usage: python synclabels.py owner/repo
import argparse
from getpass import getuser, getpass
from github3 import GitHub
user = raw_input('GitHub username: ')
password = ''
while not password:
password = getpass('Password for %s: ' % user)
@Bockit
Bockit / gist:6118997
Created July 31, 2013 03:10
TSV to CSV, easy enough to make it go the other way too
csv.writer(file('data/asylum/asylumseekers_global.csv', 'w+'), delimiter=',').writerows(csv.reader(open("data/asylum/asylumseekers_global.tsv", 'Ur+'), delimiter='\t'))
@Bockit
Bockit / Embed.html
Last active December 21, 2015 10:09
Embed code and postie.js It's important that the iframe comes before the script tags. jQuery must be on the page. If it isn't, you'll need to add it. If you change the id or name of the frame, keep both the same. Also, make sure to update the strings in the JavaScript. You can find the script 'postie.js' on this page as well. Also, CORS needs to…
<iframe src="http://sasha-project.s3.amazonaws.com/afr-prod/projects/politics/index.html" frameBorder="0" id="elec-frame" name="elec-frame" style="display:block; width:100%"></iframe>
<script src="js/postie.js"></script>
<script>
var $frame = $('#elec-frame')
var postie = new Postie(window.frames['elec-frame'], $frame.attr('src'))
postie.on('change:height', function(height) { $frame.height(height) })
postie.on('change:hash', function(hash) { window.location.hash = hash })
postie.on('set:scroll', function(size) {
scrollTop = size.top - ($(window).height() - size.height) / 2
@Bockit
Bockit / a.js
Created October 29, 2013 03:16
If two files have the same contents browserify is aliasing one file to the other file, which causes some function equality issues. This is my isolated example.
module.exports = function() {
console.log('I am a function');
}
@Bockit
Bockit / components.my-book.js
Last active August 26, 2017 01:03
component-semantics-test
import Ember from 'ember';
export default Ember.Component.extend({
willRender() {
console.log('rendered!')
},
click() {
this.get('select')()
},