This file contains hidden or 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
| exports.up = (knex, Promise) => ( | |
| Promise.all( | |
| knex.schema.createTable('logins', (t) => { | |
| t.increments('id').primary(); | |
| t.string('username'); | |
| t.string('password'); | |
| t.timestamp('lastLogin'); | |
| }) | |
| ) | |
| ); |
This file contains hidden or 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 ruby:2.3.0 | |
| RUN apt-get update -qq | |
| RUN apt-get install -y build-essential libpq-dev | |
| COPY Gemfile* /tmp/ | |
| WORKDIR /tmp | |
| RUN bundle install | |
| ENV app /app | |
| RUN mkdir $app |
This file contains hidden or 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 nginx | |
| COPY nginx.conf /etc/nginx/nginx.conf | |
| COPY out /usr/share/nginx/html | |
| EXPOSE 80 |
This file contains hidden or 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
| nginx: | |
| container_name: cn-public | |
| build: ./public | |
| ports: | |
| - "80:80" | |
| volumes: | |
| - ./public/out:/usr/share/nginx/html:rw | |
| links: | |
| - api1:api1 | |
| - api2:api2 |
This file contains hidden or 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
| // -------------------- Constants -------------------- | |
| const CMD_TGL = 'toggle'; | |
| const CMD_ON = 'H'; | |
| const CMD_OFF = 'L'; | |
| const MSG_CMD = 'command'; | |
| const MSG_CHAT = 'message'; | |
| const PRT_LED = 'led'; |
This file contains hidden or 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
| #include <kore/kore.h> | |
| #include <kore/http.h> | |
| #include <kore/pgsql.h> | |
| #include <string.h> | |
| #include "device.h" | |
| /* Page handler entry point (see config) */ | |
| int json_devices(struct http_request *req){ | |
| struct kore_pgsql sql; | |
| char *name; |
This file contains hidden or 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
| RSpec.configure do | |
| # reset database before each example is run | |
| # config.before(:each) { DataMapper.auto_migrate! } | |
| Mongoid.default_client.database.drop | |
| end |
This file contains hidden or 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
| if (!kore_pgsql_query(&sql, "SELECT * FROM devices")) { | |
| kore_pgsql_logerror(&sql); | |
| goto out; | |
| } |
This file contains hidden or 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
| .center-hor { | |
| position: absolute; | |
| right: 50px; | |
| left: 50px; | |
| text-align: center; | |
| } | |
| .center-ver { | |
| position: absolute; | |
| top: 50%; |
This file contains hidden or 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
| # Create an app that completes the following: | |
| # - Leap Years | |
| # - if x is divisible by 4, but not 100 | |
| def leap(number) | |
| (((number % 4) == 0) && !((number % 100) == 0)) | |
| end | |
| puts leap(4) | |
| puts leap(100) |