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 { Component, PropTypes } from 'react' | |
import GalleryView from './GalleryView.jsx' | |
import Loading from './Loading.jsx' | |
import { createContainer } from 'meteor/react-meteor-data' | |
import { Galleries } from '../../imports/api/galleries.js' | |
import { moment } from 'meteor/momentjs:moment' |
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
// http://stackoverflow.com/questions/37801654/how-to-know-when-all-promises-are-resolved-in-a-dynamic-iterable-parameter | |
function userLogIn () { | |
return $http.get('/login/user/password') | |
.then(data => data.loggedOk ? $http.get('/checkIfIsAdmin') : Promise.reject()) | |
.then(data => data.isAdmin ? $http.get('/getUserName') : Promise.reject()) | |
.then(data => data.hasUserName ? $http.get('/getDate') : Promise.reject()) | |
} | |
userLogIn().then(() => { |
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
// public key: [23, 55] | |
// private key: [7, 55] | |
class Decrypter { | |
constructor (priv, pub, mod) { | |
this.private = priv | |
this.public = pub | |
this.mod = mod | |
} |
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
// Roy Howie | |
// flight.c | |
#include <ctype.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define MIN_LOWER_BOUND 0 | |
#define MAX_LOWER_BOUND 80 |
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> | |
<title>Test1 Velocity</title> | |
<script src="./velocity.js"></script> | |
<script> | |
function press () { | |
Velocity(document.getElementById("sq"), { opacity: 0.3}, { duration: 2000, easing: "ease-in-out", loop: 5 }); | |
return 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
import Promise from 'bluebird' | |
let fs = Promise.promisifyAll(require('fs')) | |
let exec = Promise.promisify(require('child_process').exec) | |
function mapCommands (file) { | |
return file.split('\n').reduce((p, c) => { | |
let separation = c.indexOf(':') | |
p[c.slice(3, separation)] = c.slice(separation + 2) | |
return 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
function addSession (subject, calEvent) { | |
let index = getIndex(this.sessions, (session) => session.subject === subject.id) | |
if (index === -1) { | |
this.sessions.push({ | |
subject: subject.id, | |
hours: 1, | |
events: calEvent ? [ calEvent ] : [] | |
}) | |
} else { |
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 PAGES_ON_ENDS = 3 | |
function getPages (currentPage, perPage, total) { | |
let maxPage = Math.floor(total / perPage) | |
let lower = Math.max(currentPage - PAGES_ON_ENDS, 0) | |
let upper = Math.min(currentPage + PAGES_ON_ENDS, maxPage) | |
return Array.from(Array(upper - lower + 1), (_, i) => lower + 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
function* fib () { | |
var a = 0, b = 1, c; | |
yield 0 | |
yield 1 | |
while (true) { | |
c = b + a | |
a = b | |
b = c | |
yield c | |
} |
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
function paginate (title, baseQuery, baseUrl, errorRedirect, methods) { | |
if (!baseQuery.count || !baseQuery.paginateSort) { | |
throw new Error('baseQuery is missing a count or paginateSort method! - paginate.js') | |
} else if (!methods.length) { | |
throw new Error('methods must be an array of methods to apply to each document! - paginate.js') | |
} | |
return (req, res) => { | |
let documentsPerPage = Math.min(parseInt(req.query.perpage) || 15, 100) | |
let page = Math.max(parseInt(req.query.page), 0) |
NewerOlder