Skip to content

Instantly share code, notes, and snippets.

View byronmejia's full-sized avatar
🛒
🖨🖨🖨🖨🖨

Byron Mejia byronmejia

🛒
🖨🖨🖨🖨🖨
View GitHub Profile
exports.up = (knex, Promise) => (
Promise.all(
knex.schema.createTable('logins', (t) => {
t.increments('id').primary();
t.string('username');
t.string('password');
t.timestamp('lastLogin');
})
)
);
@byronmejia
byronmejia / Dockerfile
Created July 15, 2016 05:02
Sinatra Docker File
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
@byronmejia
byronmejia / Dockerfile
Created July 15, 2016 05:02
Code Network NGINX file
FROM nginx
COPY nginx.conf /etc/nginx/nginx.conf
COPY out /usr/share/nginx/html
EXPOSE 80
@byronmejia
byronmejia / docker-compose.yml
Created July 15, 2016 05:01
Code Network Website testing platform. For use in development mode.
nginx:
container_name: cn-public
build: ./public
ports:
- "80:80"
volumes:
- ./public/out:/usr/share/nginx/html:rw
links:
- api1:api1
- api2:api2
// -------------------- 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';
#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;
RSpec.configure do
# reset database before each example is run
# config.before(:each) { DataMapper.auto_migrate! }
Mongoid.default_client.database.drop
end
if (!kore_pgsql_query(&sql, "SELECT * FROM devices")) {
kore_pgsql_logerror(&sql);
goto out;
}
.center-hor {
position: absolute;
right: 50px;
left: 50px;
text-align: center;
}
.center-ver {
position: absolute;
top: 50%;
# 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)