This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @mixin image-2x($image, $width, $height) { | |
| @media (min--moz-device-pixel-ratio: 1.3), | |
| (-o-min-device-pixel-ratio: 2.6/2), | |
| (-webkit-min-device-pixel-ratio: 1.3), | |
| (min-device-pixel-ratio: 1.3), | |
| (min-resolution: 1.3dppx) { | |
| background-image: url($image); | |
| background-size: $width $height; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Views | |
| def two_form_view(request): | |
| context = {} | |
| if request.method == "POST": | |
| question_form = QuestionForm(request.POST) | |
| answer_form = AnswerForm(request.POST) | |
| success = False | |
| if 'q_button' in request.POST and question_form.is_valid() | |
| question_form.save() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import urllib2 | |
| import mimetypes | |
| from django.conf import settings | |
| from django.db import models | |
| from django.contrib.auth.models import User | |
| class Category(models.Model): | |
| name = models.CharField(max_length=32) | |
| class Meta: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Script to Build Python 3.6.3 for Ubuntu 16.04 | |
| # | |
| # Ubuntu 16.04 is and LTS release with Python for System use locked at 3.5 | |
| # This script builds Python3.6 from source and installs it in /usr/local | |
| # | |
| # Called from my VagrnantFile as | |
| # config.vm.provision :shell, inline: "bash /var/www/myproj/VagrantScripts/BuildPython36.sh" | |
| # | |
| # Inspired by the wonderful instructions at |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| var gulp = require('gulp'); | |
| var gutil = require('gulp-util'); | |
| var del = require('del'); | |
| var uglify = require('gulp-uglify'); | |
| var gulpif = require('gulp-if'); | |
| var exec = require('child_process').exec; | |
| var notify = require('gulp-notify'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Standard Python dictionaries are unordered. Even if you sorted the (key,value) pairs, you wouldn't be able to store them in a dict in a way that would preserve the ordering. | |
| The easiest way is to use OrderedDict, which remembers the order in which the elements have been inserted: | |
| In [1]: import collections | |
| In [2]: d = {2:3, 1:89, 4:5, 3:0} | |
| In [3]: od = collections.OrderedDict(sorted(d.items())) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### Solr Install ### | |
| Install pysolr and django-haystack and set up django-haystack. Setup for haystack is pretty straight forward: | |
| https://django-haystack.readthedocs.org/en/v1.2.7/tutorial.html | |
| Make sure you follow the haystack instructions for the correct version of haystack that you installed, | |
| as some of the setting variables are different depending on the version. | |
| # SSH into the server that you want to install Solr on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ##################################################### | |
| # Name: Bash CheatSheet for Mac OSX | |
| # | |
| # A little overlook of the Bash basics | |
| # | |
| # Usage: hello bash :) | |
| # | |
| # Author: J. Le Coupanec | |
| # Date: 2014/11/04 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
NewerOlder