Skip to content

Instantly share code, notes, and snippets.

View AlexFrazer's full-sized avatar
🦊
🦊🦊🦊

Frazer AlexFrazer

🦊
🦊🦊🦊
View GitHub Profile
//this will not work:
thingsToLoad: [{
id: 'thing1',
controller: my_project_controller1
}, {
id: 'thing2',
controller: my_project_controller2
}],
init: function() {
$.getJSON('/get_some_json', function(json_data) {
$('#my_rendering_div') {
// render my content
}
});
{% 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 %}
# 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')
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)
@AlexFrazer
AlexFrazer / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
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
'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);
@AlexFrazer
AlexFrazer / client.js
Created February 24, 2015 15:12
quick bug in my code using meteor
Template.imageboard.helpers({
posts: function() {
return Posts.find({}, { sort: { timestamp: -1} });
},
has_posts: function() {
return Posts.find({}).count() > 0;
}
});
Template.write.events({
@AlexFrazer
AlexFrazer / browser vs server
Created April 3, 2015 15:22
An example of publications and subscriptions
// browser
> Meteor.users.findOne()
{
_id: "1234"
}
// console
> Meteor.users.findOne()
{
_id: "1234",