This file contains 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
<button id="init">js init</button> | |
<button id="save">save</button> | |
<button id="load">load</button> | |
<div class="grid-stack"> | |
<div class="grid-stack-item" data-gs-x="0" data-gs-y="0" data-gs-width="1" data-gs-height="1"> | |
<div class="grid-stack-item-content"></div> | |
</div> | |
<div class="grid-stack-item" data-gs-x="0" data-gs-y="1" data-gs-width="1" data-gs-height="1"> | |
<div class="grid-stack-item-content"></div> |
This file contains 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
storeFile=debug.keystore | |
storePassword=android | |
keyAlias=androiddebugkey | |
keyPassword=android |
This file contains 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
from PIL import Image | |
import piexif | |
def rotate_img(img, rotate_param): | |
e = piexif.load(img.info["exif"]) | |
e['0th'][274] = 1 # no rotate | |
if rotate_param in [Image.ROTATE_90, Image.ROTATE_270]: | |
e['Exif'][40962], e['Exif'][40963] \ | |
= e['Exif'][40963], e['Exif'][40962] # swap width, height |
This file contains 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
# adduser vagrant | |
cp -r ~/.ssh ~vagrant/ | |
chown vagrant.vagrant -R ~vagrant/.ssh | |
visudo | |
# create db user | |
psql --host=endpoint --username=user --password --dbname=db | |
CREATE USER user WITH PASSWORD ''; | |
sudo yum install postgresql93-devel |
This file contains 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
angular.module('app', ['ng.django.forms']).config(function($httpProvider) { | |
$httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; | |
$httpProvider.defaults.headers.common['X-CSRFToken'] = '{{ csrf_token }}'; | |
}).controller('ctrl', function($scope, $http, $window, djangoForm) { | |
$scope.submit = function($event) { | |
if($scope.form){ | |
$http({ | |
method: 'POST', | |
url: $scope.action, | |
headers: {'Content-Type': 'application/x-www-form-urlencoded'}, |
This file contains 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
angular | |
.module('angularApp') | |
.config(['$locationProvider', function($locationProvider) { | |
$locationProvider.html5Mode(true); | |
}]); |
This file contains 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
In [1]: %load_ext autoreload | |
In [2]: %autoreload 2 |
This file contains 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
class DateTimeField(models.DateTimeField): | |
def formfield(self, **kwargs): | |
defaults = {'form_class': forms.SplitDateTimeField, | |
'input_date_formats': ['%y/%m/%d']} | |
defaults.update(kwargs) | |
return super(DateTimeField, self).formfield(**defaults) | |
class Model(models.Model): | |
date = DateTimeField() | |