Snippet: File Cat for Windows

One of my best friends came to me, asking to write a quick script. The company he helps run gets thousands of single column CSV files from some automated process. Every month, they need to run a "report" of these files, essentially concatentating them together and delimiting the output with 3 lines of 9 'x's. This process was being done across thousands of files, all manually. He knew there was a better way so he came to me to cut some man hours off of their load. - Feb. 26, 2016, 1:47 p.m.
Python Tasks scripts batch

Snippet: Quick Amend

Since i started using gerrit, and the rebase strategy in git, amending commits to keep history clean is important. Keeping this here for future reference. - Jan. 25, 2016, 12:36 p.m.

Snippet: JS Library Object

Again while building my new game in Phaser, I found I needed something more. This time I needed a Object-like object that allowed for identical keys, or values. I needed a fast way of getting one from the other and vice versa. I also needed a way to make callable functions keys, and for them to be nonunique. Initially I tried working through it with a list of objects and a clever reduce function, but I ended up diving into the prototypical inheritance and creating my own javascript object: Library. - Sept. 2, 2015, 9:59 a.m.
Projects Search Javascript Development Design Code

Snippet: Generating Sprint Maps Folders

Wrote a quick one off thing for writing complex sprite maps for my spaceship game. Needed to combine multiple images to create different versions of a sprite for thrusters. All for different types of speed. - Aug. 18, 2015, 2:40 p.m.
Python

Snippet: Scrape Entire Site

Was looking for a quick way to download a site a client had previously built so I could replicate it in a new framework. Found this little wget script online. - July 6, 2015, 4:30 p.m.
Django Customers Development Tasks CSS Code Education Quick Reference Recursion

Trick: behave-web-seed

After working with cucumber and selenium for a while at work, I decided i wanted a way to test my python application in python at the integration level. So I decided to package up Behave and Splinter with a little bit of pre-configuration and a step library that allows users to skip right to testing their websites out of the box. - Sept. 12, 2014, 12:43 p.m.
Python Projects Production Development Code Deployment Maintainability Testing cucumber

Snippet: Task-Burndown

Jokingly, I almost named this one YATA (Yet Another Task App), but this project came into existence for a few reasons. It is a first dive into a few new technologies and versions. It was my first time using all of the following; (Django==1.7, AngularJS-1.3.0, Django Rest Framework, AngularJS Material Design. It was this combination of applications that I wanted to use as a model for future development.

Besides a model, the app itself is a pretty good task app. It is inspired by the agile methodology and more specifically the sprint burndown chart (hence the name). - Sept. 11, 2014, 12:23 a.m.
Python Projects Django Javascript Development Design Tasks Burn Out Scheduling Layout CSS Code Deployment HTML API Templates AngularJS Database

Snippet: Offline Sync Demo

A quick demo of a angularJS project, cached with a .manifest file, and synced to a master database. - Aug. 22, 2014, 9:05 p.m.
Python Javascript Development Tasks Code Learning Education Deployment HTML API Testing AJAX Tree

Snippet: Cucumber Performance

At work we are using cucumber for our integration tests. We have a massive library of tests. I mean massive. The whole thing takes days to run, and each feature can take upwards of a few hours. Our team got recently tasked with increasing the run speed of the test suite. We looked at a few methods, but I ended up using a few pipe and grep methods stacked on top of --format usage. - July 10, 2014, 5:13 p.m.
Filter Testing

Trick: Django 16 Start App Template

After starting many applications in the past few months, I got somewhat tired of having to repeatedly setup the extra files that I need in a standard app. After reading the django documentation on manage.py commands I found out that you can use a start template. And even more so, you can use a github/zip as said template. So i threw together a generic "object" application that has my basic setup with all the bells and whistles I typically use. - June 9, 2014, 3:27 p.m.
Projects Django Management Admin Deployment Quick Reference Templates

Snippet: Jeopardy Board Editor in Angular

In the previous post about the javascript jeopardy board, at the end I said I would show you how to create a board using less than 100 lines of angular. Well here is that post. - March 22, 2014, 2:02 p.m.
Projects Javascript Development Code HTML Tree AngularJS Jeopardy

Snippet: Javascript Jeopardy

I was talking to my roommate and good friend about work, and he had an idea for an attraction for an upcoming conference. He wanted to build a jeopardy game, that conference goers could come by, play a quick round on an ipad, and get their score. It is a great idea, because it attracts people, you can offer prizes on top scores, and customers learn more about the company and what we do -- in a fun and interactive way.

Being an Angular.js fanboy, it was my first reaction; and why not? Single page, fast loading, only a few views, easily configurable. But after taking a few looks at the requirements we came up with this list:
  1. Must be able to run entirely locally (conference may not have reliable wifi)
  2. Stand alone scoring (for the above reason, we decided against a player vs player game -- however that will be fun to code, and I may approach it in a later version)
  3. Simple, clean, recognizable as jeopardy
So with those requirements, and a little bit of reflection, I realized that you could do it entirely in Twitter bootstrap and a little bit of jquery. So I set out to build a simple, configurable, jeopardy board. - March 22, 2014, 12:38 p.m.
Projects Javascript Koding.com Development Layout CSS Code HTML AJAX JQuery Templates Jeopardy

Snippet: Django Admin: Changing the Page Header

So 2 years after I have started professionally developing in Django, I finally got around to customizing the admin beyond skins. The one complaint I got from one of the clients is the "Django Administration" that appears in the header of the page. After some searching, I found a few solutions, including changing the translation tables, and overwriting the base_admin template. Here I will go over the one that I found to work, be the cleanest, and the most "pythonic" in adhering the the django paradigm of development. - March 7, 2014, 10:35 a.m.
Python Projects Django Customers Layout Code Quick Reference

Trick: Using AnuglarJS to Speed up Static Pages

On my career page, I show the Enteragam Project I worked on. As an overview, the Project was essentially a static page, with information about a drug, what was managed in wordpress. Because of the nature of wordpress, and having to call the database for every page load, to pull the content and draw the page, the typical load time for any click on the page was around 1100ms (the client didnt want to spend more money on giving the server more resources). To speed up the page while reducing the server load, I decided to move to Angular for this particular project. As shown, the results were pageloads over 20-50x faster. Id like to offer a brief insight into what I did for the performance benefits. - March 6, 2014, 5:33 p.m.
Projects Javascript Customers Development CSS Deployment Speed

Snippet: Message Encoding

A Converse Snippet to my Message Encoding post. After successfully working on the decoding project, I thought, why dont I create an encoding algorithm to match it?

So I did. - Oct. 28, 2013, 4:28 p.m.
Python Code Codeeval Generators

Snippet: Message Decoding

Found another difficult problem on codeeval today that I though I would use as an opportunity to explore generators in python.

The challenge can be found on codeeval at https://www.codeeval.com/open_challenges/36/.

Here is a copy of the challenge for your viewing convience:

Message Decoding

Challenge Description:

Credits: This challenge has appeared in a past ACM competition.

Some message encoding schemes require that an encoded message be sent in two parts. The first part, called the header, contains the characters of the message. The second part contains a pattern that represents the message.You must write a program that can decode messages under such a scheme.

The heart of the encoding scheme for your program is a sequence of "key" strings of 0's and 1's as follows:
0,00,01,10,000,001,010,011,100,101,110,0000,0001,. . .,1011,1110,00000, . . .

The first key in the sequence is of length 1, the next 3 are of length 2, the next 7 of length 3, the next 15 of length 4, etc. If two adjacent keys have the same length, the second can be obtained from the first by adding 1 (base 2). Notice that there are no keys in the sequence that consist only of 1's.

The keys are mapped to the characters in the header in order. That is, the first key (0) is mapped to the first character in the header, the second key (00) to the second character in the header, the kth key is mapped to the kth character in the header. For example, suppose the header is:

AB#TANCnrtXc
Then 0 is mapped to A, 00 to B, 01 to #, 10 to T, 000 to A, ..., 110 to X, and 0000 to c.

The encoded message contains only 0's and 1's and possibly carriage returns, which are to be ignored. The message is divided into segments. The first 3 digits of a segment give the binary representation of the length of the keys in the segment. For example, if the first 3 digits are 010, then the remainder of the segment consists of keys of length 2 (00, 01, or 10). The end of the segment is a string of 1's which is the same length as the length of the keys in the segment. So a segment of keys of length 2 is terminated by 11. The entire encoded message is terminated by 000 (which would signify a segment in which the keys have length 0). The message is decoded by translating the keys in the segments one-at-a-time into the header characters to which they have been mapped.

Input sample:

The input file contains several data sets. Each data set consists of a header and a message. These will all be on one line. The length of the header is limited only by the fact that key strings have a maximum length of 7 (111 in binary). If there are multiple copies of a character in a header, then several keys will map to that character. The encoded message contains only 0's and 1's, and it is a legitimate encoding according to the described scheme. That is, the message segments begin with the 3-digit length sequence and end with the appropriate sequence of 1's. The keys in any given segment are all of the same length, and they all correspond to characters in the header. The message is terminated by 000.
Your program should accept the first argument as the filename and read the contents of this file as the test data, according to the conditions above.eg.

$#**\0100000101101100011100101000

Output sample:

For each data set, your program must write its decoded message on a separate line. There should not be blank lines between messages.eg.

##*\$

- Oct. 28, 2013, 3:14 p.m.
Python Projects Code Learning Codeeval Generators

Snippet: IE8 Compantibility Mode

After 6 weeks of hunting a phantom IE8 bug, Bryan found a difference in our and the users setups. He found that the Security zone settings was Medium-High on the users laptops, instead of just Medium. We then were able to reproduce the errors. Then using the developer tools I was able to determine that IE was rendering in IE7 Document mode and IE8 Compatible mode. After manually overriding these, the page rendered correctly. After a little research, I found out how to fix the issue that had been plaguing us. - Oct. 24, 2013, 5:06 p.m.
Development Layout Learning Deployment

Snippet: Minesweeper

This weekend I hung out with my roommate and did back to back power hours. During which time I decided to have my own on codeeval to test out the well known Ballmer Peak. The CodeEval challenge I decided to tackle was Minesweeper.

Here is my solution: - Oct. 21, 2013, 11:29 a.m.
Python Code Learning

Tip: On Job Search: Manage your Public Brand

One thing I have found from both sides of the interview table is how important a public profile is. Your public profile, your online presence, and your brand are all terms for you on the searchable internet. What can employers see if they go looking for you? - Oct. 21, 2013, 11:18 a.m.
Projects Search Development Perspective Code Employment Job Search

Snippet: My First Angular App

A few weeks ago I raved on about AngularJS and how much faster and easier it made frontend development. The app I was working on was a simple, short reformatting application that was mean to take a file, apply a set of rules and run it against a template. Since then the application has taken off, now powered by a CouchDB backend and using much more of the angular framework.

Now that I have my new app running in production, I would like to share its humble beginnings, along with why I did it the way I did it. It will also by my crack at a full angular application tutorial.

You can download this project from my github page at https://github.com/mc706/formatter or you can view the final product here. - Oct. 17, 2013, 11:41 a.m.
Projects Table Filter Search Javascript Development Bootstrap Layout CSS Code HTML AJAX Templates AngularJS

Snippet: Django Recursive Model Structure

I recently built a web app for a customer who wanted a "windows explorer like" organization structure. What they meant by that is they wanted a set of Organizational Units, that could either contain more organizational units or a set of note objects. The overall system was essentially a digital filing cabinet that supported nesting.

After some brainstorming I came up with not only the backend solution (which was pretty easy), but also a front end visual interface for it using a tree structure. Since the original product was private, I have changed the base models and core structures while retaining the recursive code to share the gist of the solution here. - Aug. 13, 2013, 10:19 a.m.
Python Projects Django Table Javascript Development Bootstrap Layout CSS Code ManyToMany HTML Templates Tree Recursion

Snippet: Django Slug Fields

Slug fields are an easy way to make allow users to understand their bookmarks and make it super easy to understand what is going on in your analytics. By keeping the title of an article or post in the title, it is easy to see in the history or analytics reports where people are or have been.

Django has a built in slug field generator. It is really useful through the admin, and easily configurable as well, but requires a bit of modification to use if submitting from anywhere but the admin panel.

The big example I found of django slug fields is http://www.theonion.com/. Each of their articles looks a little something like this: http://www.theonion.com/articles/insecure-frustrated-bully-with-something-to-prove,33427/. So the slug field is easy to see, but after it there is a comma and a number. After a little poking around, I found out that you can change the slug field to whatever; theonions (which runs django) is using the number after the coma as the identifier for the articles.

This removes their dependency on unique slug fields. I took a page out of their book and implemented aesthetic only slug fields on my personal site. Because they dont affect anything, they are entirely optional and easy to implement after the fact. Here is a overview of my implementation. - Aug. 9, 2013, 1:24 p.m.
Blog Python Projects Django Search Development Saving Code Slug

Tip: Django Template Inheritance

One of the core principles of of django as a framework is DRY, Dont Repeat Yourself. Probably the best example of where django implements DRY is its templating system. When I first started on the web in PHP, I wrote out every single page from scratch. This made my projects huge. Then I learned about includes and it allowed me to take common code like headers and footers out of every page. >br>
When I was first introduced to django, the templating system amazed me and I wondered why anyone would ever do differently. - Aug. 7, 2013, 10:30 a.m.
Python Django Table Development Code HTML Templates

Snippet: Django Infinite Scrolling

For my main project, I began running into the problem of pagination becoming too long and making increasingly hard to find what you are looking for amongst all the pages. The obvious solution was to add a search function and just show all the object in a table. But then the issue arose that as between 20-30 objects being added a day, a generic search would still display hundreds of results, and take forever to load. My first response to this was to make it an ajax call and have a spinning .gif display while waiting for the results. I quickly realized that within a few months, the site would be painfully slow trying to return the massive number of results of even the most basic searches, so I looked for other solutions.

Enter Facebook, of all sites. but when it comes to dealing with Big Data and massive amounts of it on a single page (ie a profile page) they know how to do it best. As you are scrolling down someones timeline, as you reach the bottom of the page, it makes a call for more information. This way, there is a small amount of initial information being loaded, and a small time (amount a screens worth) of information being loaded every time you reach the bottom of the page. It is a solution that scales for all data sizes because the amount of data transferred each time is set, and it will just iterate over the large data set however many times until the user finds what they are looking for.

The implementation is actually pretty simple. It involves simply checking the size of the data set (I use a table) against the parent window which handles the overflow, checking against jQuery.scrollTop(), then making the appropriate ajax call. On the django site, you need to set up a limiter to only send so many objects. - Aug. 6, 2013, 11 a.m.
Python Projects Django Table Filter Javascript Development Design Layout Code JQuery Scrolling

Trick: Python Selenium Browser Testing

When dealing with web based projects, especially larger ones, regression testing is very important when you change dependencies or environments. There are certain things you can do on the backend such as django testing, that allows you to test your models and a few other things, but to actually test through the browser is required. The problem is then further complicated by testing across browsers and testing all the different functionality and features of each page.

To do true regression testing with browser, I have started using Selenium for Python. This allows me to write a testing script, and use python unittest or another testing framework like nose, to automatically run through a my website and check key functionality. Here is a quick guide to settings up Python Selenium Webdriver tests. - July 9, 2013, 11:04 a.m.
Python Django Production Development Code Deployment Workflow Maintainability HTML Testing

Snippet: Inline Tagging MultiSelect

While I was redesigning one of my older projects to be a little bit more user-friendly, I found myself in need of replacing the multiselect widget with something a bit user friendly. The problem with <lselect multiple=multiple> is that when you need to select from a long list, you need to hold down select and scroll through the list and click on what options you want. If you forget to hold control, you loose all your other selections. The other problem is on larger lists, you need to show more space, which then consumes valuable screen real estate. My particular instance involved selecting users from a list of 300 or so for creating a notification list. It ended up being one of the least important fields was taking up most of the screen.

So I went out looking for a solution to my multiselect widget problem. The design goals in mind were to mirror something like gmail (the address line has an autocomplete dropdown), the facebook tagging system, and the stackoverflow tagging system. These systems took your text input, generated a search list, displays the results inline like an autocomplete, then add tag objects that can be removed at a later time.

After some digging and moving from a mootools to a jquery plugin, I finally found FCBKcomplete on github. The following is a simple implementation of it using django as the backend. - July 4, 2013, 10:25 p.m.
Python Projects Django Search Javascript Development Design Users Groups CSS Code ManyToMany Widget MultiSelect

Snippet: IE8 Cross Domain Ajax Requests

A problem that I ran into when doing my City State Autopopulate Ajax Call was, to no supprise, IE8. After extensive digging, I found out why. My Ajax call was to the Google Maps API (you can read about it more on my City State Post. It turns out previous to IE10, Internet Explorer uses its own, Microsoft-made Cross Domain Request system, or XDomainRequest for short. The XDR system is different than every other browser, which uses XMLHttpRequest. There are a number of ways of fixing this if you need to include IE support. I will list 2 here. - July 1, 2013, 8:18 a.m.
Projects Production Javascript Code Quick Reference AJAX

Trick: Django Sitemaps

A important part of SEO is having a sitemap.xml defined so bots and spiders can index your site properly. Django provides a build it handler for the sitemap functionality that is easy to configure and deploy. This guide is taken from the documentation and is here to show it implemented for my site. The documentation can be found at The Django Docs". - June 28, 2013, 12:24 p.m.
Blog Python Projects Django Search Development Sitemap

Snippet: Django Twitter Connector

To crown the completion of my own installation of the django twitter connector, I will make my first post via the connector about the connector.

This implementation uses django signals to trigger the python-twitter connector to use the Twitter API. Credit goes to the creators of the python-twitter library and to this django snippet. - June 28, 2013, 1:01 a.m.
Blog Python Projects Django Development Permissions Code API Twitter

Snippet: Find City and State from Zip Code

One of our systems at work allowed users to fill in an address only using the zip code. It would do a reverse lookup against a database and bring back the city and the state. Unfortunately when upgrading the system, this part broke. I wrote some one off code to replace this functionality using an ajax call to the Google Maps API. - June 14, 2013, 9:09 p.m.
Projects Search Javascript Development Code HTML

Snippet: iFrames in IE8

This is a problem I have had the unfortunate experience of crossing paths with on more than one occasion. In a site I worked on for work that was in Classic ASP, that was heavily based in iframes posting to other iframes. The problem I ran into was in Internet Explorer 8, where my iframes would not always render. To make the problem worse, they would magically appear once I launched firebug lite, to try to figure out why. It was a serious problem that took many hours and a lot of frustration to deal with. - June 6, 2013, 5:31 p.m.
Projects Javascript Development CSS Code HTML

Trick: Synergy

Do you have multiple computers at your workstation? Do you use multiple operating systems simultaneous across computers? Want to only use 1 mouse and keyboard for all your machines? Want to do it for free?

For me, the answer was yes to all of them. I have my laptop running windows 8, and might sit at my desktop at work running ubuntu or my windows 7 computer at home. Synergy is a free, open-source software download that runs cross platform that allows you to use one mouse and keyboard and move them computer to computer, regardless of platform. It will even copy the Clipboard Buffer so you can copy information on one computer and mouse over to another and paste it. It has truely streamlined my multi-computer, multi-platform workfllow/ - May 29, 2013, 5:06 p.m.
Layout Platform Workflow Mutli-Montiors

Snippet: HTTP Status Codes Quick Reference

Quick reference with map and table of status codes. Copied from official registry. - May 28, 2013, 9:16 p.m.
Quick Reference

Snippet: Django CSRF Quick Reference

A quick reference for using CSRF in django including how to exempt functions in views and how to add csrf protection to ajax requests.
For Reference, CSRF protection stands for Cross Site Request Forgery protection which protect against Cross Site Request Forgeries - May 28, 2013, 8:34 p.m.
Python Django Javascript Code Quick Reference CSRF Protection

Snippet: Django Admin ManytoMany Widget

When working on my WebAggregator.net project, I found I was in need of an easy to use, intuitive many to many relationship manager interface. Looking around into the built in admin, I really liked the permissions manager. So after a little digging and findout it it is called the "filter_horizontal" widget in the admin, I found a solution which I will post here. - May 28, 2013, 6:14 p.m.
Python Projects Django Javascript Development Design Bootstrap Users Permissions CSS Code Admin ManyToMany

Trick: Simple Flat Field Search

I have seen a lot of different ways of implementing search functions in many different languages. Even for django there are a variety of ways to implement search, most notably Haystack. However many of these ways are take a lot to set up and if you are looking to implement a simple search like the one I have listed in the header for this site, ill show my quick fix for search.

*Note this is still in its infancy, and is best used with small datasets for one off searches. This will make many calls to the database, so do NOT try to use this on much larger data sets. I would suggest the aforementioned Haystack for Django to do largescale searches with a search engine backend installed. - May 18, 2013, 1:54 p.m.
Python Django Filter Search

Snippet: Django ManyToMany Inline Admin

So I ran into this problem when working on the element aggregator where i wanted to have an inline across a ManyToManyField. So after some googling and finally finding it in the docs, I am adding it here for my quick reference and hopefully at least one of you will find it useful at some point. - May 18, 2013, 10:57 a.m.
Python Projects Django Code Admin ManyToMany

Trick: Django Local Settings

If you are following a good development process, you are most likely developing, testing, and host production in entirely different instances, often with different databases. If you are using version control, maintaining 3 or more different settings files can be a pain.

Using a local settings settings file, that is then added to you .gitignore, allows you to keep one settings file in verison control, but apply settings to each environment. It also provides a little bit more security if you are sharing your code, as your username and password and database name can be kept out of the settings file. - May 18, 2013, 9:53 a.m.
Python Projects Django

Snippet: Block Wheel 4

Ok this may have gotten a little bit out of hand, but once it got moving I had to see how far I could take it. So after adding N layers, I added the ability so that all the sliders (what i have come to call them) move in the same direction. Then while watching a pretty large one (I expanded the supported size all the way up to 25), the idea hit me. I am actually moving each tile around the page. What if the entire grid where a color scale. Each layer would spin at a different speed, with the inner layers moving faster. So I essentially created a whirlpool. Now I wanted to pour paint in it. It came back with interesting results. - May 14, 2013, 7:59 p.m.
Projects Javascript Layout CSS Code

Snippet: Block Wheel 3

So shortly after adding the second layer, I wanted to see what more would look like, so I added a third layer. However there was almost nothing new learned from expanding to 3 other than it looking really cool. So as to not ruin the opportunity to play around and learn something new (and to see how cool I could make it look) I asked myself the question: "How would I create it so that it is N levels deep". - May 14, 2013, 7:35 p.m.
Projects N-Generator Javascript Layout CSS Code

Snippet: Block Wheel 2

So I go curious and wanted to see if what it would look like if I added more layers to the equation. So I manually added 2 layers to the rotation with interesting results. - May 14, 2013, 7:13 p.m.
Projects Javascript Layout CSS Code

Snippet: Inkblot 2

So I was playing around with the code for inkblot and was curious if i could make it 2 way mirrored instead of just 1. Ill walk through the changes and the reasoning behind them. - May 13, 2013, 1:29 p.m.
Javascript Layout CSS Code

Snippet: Block Wheel

I downloaded LightTable and was playing around with the live render for HTML and Javascript, when i noticed the busy icon. It was a set of 9 blocks spinning around, an i thought to myself, "Wow, that is cool. I wonder if i could do that in HTML". After a few minutes of playing, here are the results. - May 13, 2013, 12:42 p.m.
Javascript Design Layout CSS Code

Snippet: Inkblot Code

As covered my projects page, I here is a little code for a randomly generated inkblot test built in a grid with triangles. Secondary Inspiration is drawing mirrored triangles in graph paper. - May 6, 2013, 11:53 p.m.
Random Table Javascript Layout CSS

Snippet: Recent Actions Using Django Admin Log

If you use the Django Admin Panel a lot like I do, you know there is a "Recent Actions" table on the home page. Recently I set out to create a table (the updates table on the homepage) that is driven by this log. - May 6, 2013, 8:16 p.m.
Blog Python Django Filter Development

Trick: Pretty Print Code in HTML

If you were wondering how to get the code formatting I use to display my code, I use the Google prettyprint JavaScript library. It automatically formats code inside of <pre> tags, and makes code very readable. - May 6, 2013, 8 p.m.
Colors Javascript CSS Code

Trick: Fluid CSS Columns

A CSS alternative to JQuery Masonry, can be used to create fluid tile/column pages. Referenced from sickdesigner.com. - May 6, 2013, 5:59 p.m.
Design Layout CSS

Tip: Organize Your Finances with Mint.com

For the longest time I had somewhat of a problem planning my financial life; saving money, preventing impulse buying, and paying bills. Mint.com gave me the one look, snapshot of my current financial situation at any given point and allowed me to make more educated decisions on how to spend my money. - May 6, 2013, 5:12 p.m.
Management Finances Saving

Snippet: Multidispatch for Django

A shortcut decorator I created by combining a few different libraries out there to give me a quick way of rendering a django view to a mobile site or desktop site by detecting the browser.

To use this code, I created a /mobile directory in the /templates directory in each app. I used JQuery Mobile to create a set of templates for the mobile version of the site. Then i pass the mobile mobile and the desktop versions as arguments into the decorator and it will render different according to what browsers is being used. - May 6, 2013, 3:37 p.m.
Python Django Development Design Mobile JQuery Mobile

Snippet: Adding All Users into a Group in Django

I ran into the issue when implementing an new instance of my internal management app for a sister company of having to add all 300 users to a group in django. I had a group "Employee" which dictates the permissions of all basic users, what modules they can see, and what permissions anybody logging into the system has. It was not something i particularly wanted to do by hand so i dropped to the shell for a quick 5 liner. - May 6, 2013, 2:09 p.m.
Python Django Users Groups Permissions

Tip: Go Ketogenic

A diet and lifestyle that will change the way you look at food, energy, and weight loss. - March 1, 2013, 8:17 p.m.
Ketogenic Diet Health Weight Loss Energy

Trick: Fast Table Search and Filter

HTML and Javascript table filter that doesn't require reloads - Feb. 27, 2013, 6:17 p.m.
Projects Table Filter Search Javascript

Snippet: Python Color Wheel

Code for generating N equally distant colors. - Feb. 25, 2013, 8:50 p.m.
Python Colors Random N-Generator
Tags
Blog (4) Python (26) Projects (27) Django (20) Production (3) Colors (2) Random (2) N-Generator (2) Table (6) Filter (6) Search (9) Javascript (23) Customers (3) Koding.com (1) Development (24) Ketogenic (1) Diet (1) Health (1) Weight Loss (1) Energy (1) Design (8) Bootstrap (3) Tasks (4) Users (3) Groups (2) Permissions (3) Burn Out (1) Scheduling (1) Mobile (1) JQuery Mobile (1) Management (2) Finances (1) Saving (2) Layout (15) CSS (17) Perspective (1) Code (32) Learning (4) Education (2) Admin (3) ManyToMany (4) Deployment (7) Quick Reference (6) CSRF (1) Protection (1) Platform (1) Workflow (2) Mutli-Montiors (1) Maintainability (2) HTML (10) API (3) Twitter (1) Sitemap (1) Testing (4) AJAX (4) Widget (1) MultiSelect (1) JQuery (2) Scrolling (1) Templates (6) Slug (1) Tree (3) Recursion (2) AngularJS (3) Database (1) Employment (1) Job Search (1) Codeeval (2) Generators (2) Speed (1) Jeopardy (2) cucumber (1) scripts (1) batch (1)