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
def jsonize(self, data_dict): | |
dict_string = {} | |
for key, value in data_dict.items(): | |
if isinstance(value, QuerySet): | |
dict_string[key] = serializers.serialize('json', value) | |
else: | |
dict_string[key] = json.dumps(value) | |
json_str = '{' | |
for key, value in dict_string.items(): | |
json_str += '"%s":%s,' % (key, value) |
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
const passProps = (props, component) => { | |
return { | |
type: 'LOCAL_STATE', | |
props, | |
component | |
} | |
} | |
const getElementWithLocalState = ({ clicked = false }) => { | |
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
#!/bin/bash | |
# | |
# Task delete merged local and remote branches | |
# | |
EXCLUDE="master|next|release" | |
# local | |
git branch --merged remotes/origin/next | grep -v -E "$EXCLUDE" | xargs -n 1 git branch -d |
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
ImageProcessor.prototype.run = function ImageProcessor_run(config) { | |
return new Promise(function(resolve, reject) { | |
// If object.size equals 0, stop process | |
if ( this.s3Object.object.size === 0 ) { | |
reject("Object size equal zero. Nothing to process."); | |
return; | |
} | |
if ( ! config.get("bucket") ) { | |
config.set("bucket", this.s3Object.bucket.name); |
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
// promise hell | |
ImageProcessor.prototype.execResizeImage = function ImageProcessor_execResizeImage(option, imageData) { | |
return new Promise(function(resolve, reject) { | |
var resizer = new ImageResizer(option.size); | |
resizer.exec(imageData) | |
.then(function(resizedImage) { | |
var reducer = new ImageReducer(option); | |
reducer.exec(resizedImage) | |
.then(function(reducedImage) { |
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
// unhell promise | |
ImageProcessor.prototype.execResizeImage = function ImageProcessor_execResizeImage(option, imageData) { | |
var resizer = new ImageResizer(option.size); | |
return resizer.exec(imageData) | |
.then(function(resizedImage) { | |
var reducer = new ImageReducer(option); | |
return reducer.exec(resizedImage) | |
}); | |
}; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
</head> | |
<body> | |
</body> | |
<script src="./angular.js"></script> |
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
<?php | |
function get_local_db() | |
{ | |
return array( | |
'username' => 'dbuser', | |
'hostname' => 'localhost', | |
'password' => '', | |
'database' => 'pujcka2' | |
); |
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
var imageInDOM = document.getElementById('image-' + index); | |
if (imageInDOM) { | |
imageInDOM.querySelector('h3').textContent = timeLastUpdated; | |
} else { | |
var flickr = document.createElement('div'); | |
var flickrH1 = document.createElement('h1'); |
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
var FlickrImage = React.createClass({ | |
render: function() { | |
// Figure out how long ago this photo was taken. | |
var fromNow = moment(this.props.image.lastUpdated).fromNow(); | |
// Render away! | |
return ( | |
<div className="flickr-image"> | |
<h1>{this.props.image.title}</h1> |
OlderNewer