Skip to content

Instantly share code, notes, and snippets.

View mgrouchy's full-sized avatar

Mike Grouchy mgrouchy

View GitHub Profile
@mgrouchy
mgrouchy / backendhackerbug.js
Last active August 29, 2015 14:02
There is a bug in the Backend Hacker Job application page( http://jobs.bufferapp.com/backend-hacker# ) in Chrome Version 36.0.1985.84 beta, you cannot reveal your personal email. I expect this is because of the structure of the page the input is no longer a direct child of #sameemails. This is a quick fix I made so I could submit the form. Scree…
//replace this
$("#sameemails>input").change(function(){
if ( $(this).is(':checked') ) {
$("#personal_email").hide();
} else {
$("#sameemails").hide();
$("#personal_email").show();
}
});
# This configuration will set up a database (db) and a web server (web) VM.
# Assumes the use of VirtualBox 4.3.14-95030 as a provider.
# Uses vagrant-vbguest plugin (https://github.com/dotless-de/vagrant-vbguest)
# to keep VirtualBox Guest Addition wrangled.
# Configuration
# Machine-specific configuration
DB_INSTALL_SCRIPT = "vagrant_data/db/install.sh"

JavaScript Testing with Grunt, Mocha and Chai

In the following post I would like to introduce one way how you can setup your testing workflow for JavaScript development. The central components in the testing environment are Grunt, Mocha and Chai that I will cover from the introduction and installation of each component to the cooperation of all components for the execution of tests.

If you are already an experienced Grunt user and just look for the Gruntfile.js and the Mocha / Chai setup just skip the central components section and skip to the installing components part.

You can find the sample project with all code at GitHub on: https://github.com/maicki/sample-js-testing-grunt-mocha-chai

Central Components

mport socket
import struct
import re
MAC_PATT = re.compile('([a-fA-F0-9]{2}[:|\-]?){6}')
MAC_PARTS_PATT = re.compile('[a-fA-F0-9]{2}')
def WOL(mac_addr, ip):
"""comments go here"""
@mgrouchy
mgrouchy / snippet.py
Created May 5, 2010 01:02
map values from dict to django model where values are not necessarily coming from serialization
def bind(self, values, **options):
exclude = options.get('exclude', [])
rename_fields = options.get('rename_fields', {})
for (field_name, field_value) in values.iteritems():
if field_name not in exclude:
if field_name in rename_fields.keys():
field_name = rename_fields[field_name]
field = self._meta.get_field(field_name)
if field.choices:
<!-- http://twitter.com/mgrouchy/status/13429079254 -->
<style type='text/css'>
.bbpBox{background:url(http://s.twimg.com/a/1271891196/images/themes/theme15/bg.png) #022330;padding:20px;}
p.bbpTweet{background:#fff;padding:10px 12px 10px 12px;margin:0;min-height:48px;color:#000;font-size:18px !important;line-height:22px;-moz-border-radius:5px;-webkit-border-radius:5px}
p.bbpTweet span.metadata{display:block;width:100%;clear:both;margin-top:8px;padding-top:12px;height:40px;border-top:1px solid #fff;border-top:1px solid #e6e6e6}
p.bbpTweet span.metadata span.author{line-height:19px}
p.bbpTweet span.metadata span.author img{float:left;margin:0 7px 0 0px;width:38px;height:38px}
p.bbpTweet a:hover{text-decoration:underline}
p.bbpTweet span.timestamp{font-size:12px;display:block}
</style>
import os
import sys
apache_configuration= os.path.dirname(__file__)
project = os.path.dirname(apache_configuration)
workspace = os.path.dirname(project)
sys.path.append(project)
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
if settings.DEBUG:
urlpatterns += patterns("",
(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT, 'show_indexes':True}),)
mkdir ~/virtualenvs
" Vim syntax file
" Language: Django template
" Maintainer: Dave Hodder <dmh@dmh.org.uk>
" Last Change: 2010 May 19
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")