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
// flux.js | |
var Alt = require('alt'); | |
export default class Flux extends Alt { | |
constructor() { | |
super(); | |
this.addActions('ActionCreators', require('./actions/TodoActions')); | |
this.addStore('TodoStore', require('./stores/TodoStore')); |
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
// flux.js | |
var Alt = require('alt'); | |
export default class Flux extends Alt { | |
constructor() { | |
super(); | |
this.addActions('ActionCreators', require('./actions/TodoActions')); | |
this.addStore('TodoStore', require('./stores/TodoStore')); |
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 f = function(n) { | |
if (n <= 1) { | |
return 1; | |
} else { | |
return n * f(n - 1); | |
} | |
} | |
var getP0 = function(y) { | |
var sum = 0; |
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> | |
<head> | |
<meta charset="utf-8"> | |
<title>Yahoo Weather API</title> | |
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script> | |
</head> | |
<body> | |
<select id="cities"></select> |
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
#! /usr/bin/env node | |
var globalInstanceId; | |
var qs = require('querystring'); | |
var http = require("http"); | |
var server = http.createServer(function (request, response) { | |
console.log(request.url, request.remoteAddress); | |
if (request.method == 'POST') { | |
var body = ''; |
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
module multiplier(load, clk, m1, m2, ready, P); | |
input [7:0] m1, m2; | |
input load, clk; | |
output [15:0] P; | |
output ready; | |
reg [7:0] A, B; | |
reg [15:0] pp, P; |
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.db import models | |
class Field(models.Model): | |
device_id = models.IntegerField() | |
field = models.IntegerField() | |
class Sensor(models.Model): | |
name = models.CharField(max_length=30) | |
device_id = models.IntegerField() | |
fields = models.ForeignKey(Field) |
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
// service.js | |
.factory('authService', ['$http', '$route', function ($http, $route) { | |
var auth = { | |
isAuth: false, | |
user: null | |
}; | |
$http | |
.get('/api/session') | |
.success(function (data) { |
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
// service.js | |
app | |
.factory('authService', ['$http', function ($http) { | |
var auth = { | |
isAuth: false, | |
user: null | |
}; | |
$http | |
.get('/api/session') |
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 User = require('../../models/user'); | |
module.exports = function (router) { | |
router.route('/api/user') | |
.get(function (req, res) { | |
console.log('get'); | |
User.readAll(function (err, readUsers) { | |
// reply is a custom function added by my middleware | |
res.reply(readUsers, err, 'cannot read users'); | |
}); |