Skip to content

Instantly share code, notes, and snippets.

View bergantine's full-sized avatar

J*Bergantine bergantine

  • London, United Kingdom
View GitHub Profile
@bergantine
bergantine / Readme.md
Last active August 29, 2015 13:55
Vagrant config for a new Ruby on Rails project
@bergantine
bergantine / Vagrantfile
Last active August 29, 2015 13:56
Modifying django-newproj to use with Zurb Foundation
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
@bergantine
bergantine / Gruntfile.js
Last active August 29, 2015 13:56
package.json for Grunt-cli
module.exports = function(grunt) {
grunt.registerTask('watch', [ 'watch' ]);
grunt.initConfig({
less: {
style: {
files: {
"css/screen.css": "less/screen.less"
}
@bergantine
bergantine / __init__.py
Created March 2, 2014 14:39
__init__.py file for a #Django #tests directory to run any or each #test in that #directory (for Django < 1.6)
import pkgutil
import unittest
for loader, module_name, is_pkg in pkgutil.walk_packages(__path__):
module = loader.find_module(module_name).load_module(module_name)
for name in dir(module):
obj = getattr(module, name)
if isinstance(obj, type) and issubclass(obj, unittest.case.TestCase):
exec ('%s = obj' % obj.__name__)
@bergantine
bergantine / pprint_list.py
Last active August 29, 2015 14:06
#python #pprint a #list
import pprint
mylist = [ ... ]
with open('mylist_saved_to_a_file.py', 'w') as f:
pprint.pprint(mylist, f)
@bergantine
bergantine / gist:989602
Last active September 25, 2015 21:47
SCSS Mixix Example. #sass #scss #demo
// example of string interpolation in a mixin
// matches a particular color and image together following a naming scheme for the images
$green: #7bd939;
$orange: #de712c;
@mixin sectionhead($color, $name) {
.section-head {
background-color: $color;
background-image: url('../../images/masthead-' + $name + '.jpg');
@bergantine
bergantine / gist:1147298
Last active September 26, 2015 19:27
Python offline manifest file creator. #html5 #python #offline #manifest
#! /usr/local/bin/python
"""
Creates a file in the same directory named offline.manifest,
or if that file already exists, replaces its contents with project files.
To ignore files of a particular type add their file extension to the ignore list.
"""
import os
@bergantine
bergantine / gist:1157441
Last active September 26, 2015 20:48
Django filter stack to cleanup WYSIWYG output. #djangotemplate
{{ value|removetags:"br div p span style"|safe|linebreaks }}
@bergantine
bergantine / CSS
Last active September 26, 2015 22:57
JavaScript to retrieve the unicode of a character for CSS (from Rogie King). #css #unicode #rogieking #javascript
content: "\2318";
@bergantine
bergantine / gist:1445036
Last active September 28, 2015 13:27
Responsive JS. #javascript #responsive
window.onresize = function() {
responsiveLoad();
}
window.onload = function() {
responsiveLoad();
}
function responsiveLoad() {
console.log('resized');