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
//this will not work: | |
thingsToLoad: [{ | |
id: 'thing1', | |
controller: my_project_controller1 | |
}, { | |
id: 'thing2', | |
controller: my_project_controller2 | |
}], | |
init: function() { |
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
$.getJSON('/get_some_json', function(json_data) { | |
$('#my_rendering_div') { | |
// render my content | |
} | |
}); |
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
{% extends "index.html" %} | |
{% block charts %} | |
{% for c in charts %} | |
<div id="{{ c['id']}}"></div> | |
{% endfor %} | |
<script type="text/javascript"> | |
var charts = {{ charts }} | |
</script> | |
<script src="{{ url_for('static', filename='render_charts.js') }}"></script> | |
{% endblock %} |
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
# imports are here | |
app = Flask(__name__) | |
app.secret_key = os.urandom(24) | |
@app.route('/') | |
def redirect_current_date(): | |
redirect(url_for('charts', date=datetime.now().strftime('%Y%m'))) | |
@app.route('/chart_group1') |
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 app.extensions import db | |
class Article(db.Model): | |
""" database representation of an article """ | |
id = db.Column(db.Integer, primary_key=True) | |
title = db.Column(db.String(128)) | |
subtitle = db.Column(db.String(512)) | |
body = db.Column(db.Text()) | |
votes = db.Column(db.Integer, default=1) | |
views = db.Column(db.Integer, default=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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 java.util.*; | |
import java.io.*; | |
public class Project { | |
public static void main(String[] args) { | |
// define the input for the user | |
Scanner userInput = new Scanner(System.in); | |
// the path to the file you want to load. This will have to change on your computer | |
String path = "/home/alex/code/java_examples/csv.txt"; | |
// use that path to read the file at that path name. See the readFile method |
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
'use strict'; | |
angular.module('app') | |
.controller('CreateWorkflowCtrl', function($scope, $location, Workflow, Category) { | |
$scope.workflow = new Workflow(); | |
$scope.page = 0; | |
$scope.create = function() { | |
$scope.workflow.$save(function(data) { | |
$location.path("/workflow/" + data.id); |
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
Template.imageboard.helpers({ | |
posts: function() { | |
return Posts.find({}, { sort: { timestamp: -1} }); | |
}, | |
has_posts: function() { | |
return Posts.find({}).count() > 0; | |
} | |
}); | |
Template.write.events({ |
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
// browser | |
> Meteor.users.findOne() | |
{ | |
_id: "1234" | |
} | |
// console | |
> Meteor.users.findOne() | |
{ | |
_id: "1234", |
OlderNewer