This is from the challenge at the end of the the "javascript data structures and control" section of stream 1
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 django.contrib.contenttypes.models import ContentType | |
from django.core.urlresolvers import reverse | |
from django.db import models | |
class AdminURLMixin(object): | |
def get_admin_url(self): | |
content_type = ContentType \ | |
.objects \ | |
.get_for_model(self.__class__) | |
return reverse("admin:%s_%s_change" % ( |
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
user nginx; | |
worker_processes 2; | |
error_log /var/log/nginx/error.log warn; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} |
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 single_pair_validator = function(hand){ | |
}; | |
var high_card_validation = function(white_numbered_hand, black_numbered_hand){ | |
for(var i=0; i < white_numbered_hand.length; i++){ | |
if(white_numbered_hand[i] > black_numbered_hand[i]){ | |
return "White wins"; | |
} | |
if(white_numbered_hand[i] < black_numbered_hand[i]){ |
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
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
tagName: 'li', | |
classNames: ['slide-list__list__item'], | |
didInsertElement() { | |
this._super(...arguments); | |
this.get('childRendered')(); | |
} | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
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 UK = d3.locale({ | |
"decimal": ".", | |
"thousands": ",", | |
"grouping": [3], | |
"currency": ["£", ""], | |
"dateTime": "%a %b %e %X %Y", | |
"date": "%m/%d/%Y", | |
"time": "%H:%M:%S", | |
"periods": ["AM", "PM"], | |
"days": ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], |
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 flask import Flask, jsonify | |
from flask_mysqldb import MySQL | |
app = Flask(__name__) | |
app.config['MYSQL_HOST'] = 'localhost' | |
app.config['MYSQL_USER'] = 'root' | |
app.config['MYSQL_PASSWORD'] = 'testtest1234' | |
app.config['MYSQL_DB'] = 'test_db' | |
mysql = MySQL(app) |
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
$scope.submitForm = function(isValid) { | |
if ($scope.userForm.$valid) { | |
alert('Thank you for registering'); | |
location.reload(); | |
} else { | |
alert('Error registering'); | |
} | |
} |
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
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
classNames: ['drag-box'], | |
attributeBindings: ['draggable'], | |
draggable: true, | |
x: 0, | |
y: 0, | |
positionChanged: Ember.observer('x', 'y', function(){ | |
this.$().css({ |