FuelPHPでRestコントローラ(WebAPI)を作成するタスクを作成しました。
- ↓のrest.phpを
fuel/app/tasks/
の中に置く - タスクを実行するコマンド(
php oil r rest [name]
)を叩く
<?php | |
class Controller_User extends Controller_Rest | |
{ | |
protected function validateHash() | |
{ | |
$request = file_get_contents('php://input'); | |
$requestHeaders = apache_request_headers(); | |
if (!isset($requestHeaders['X-Auth']) || !isset($requestHeaders['X-Auth-Hash'])) { | |
$this->response('fail!',401); |
CREATE DATABASE profs; | |
USE profs; | |
CREATE TABLE professors ( | |
name varchar(30) NOT NULL, | |
specialization varchar(20), | |
salary double(8,2), | |
CONSTRAINT prof_pk PRIMARY KEY (name)); | |
CREATE TABLE students ( |
#!/bin/sh | |
## backup each mysql db into a different file, rather than one big file | |
## as with --all-databases. This will make restores easier. | |
## To backup a single database simply add the db name as a parameter (or multiple dbs) | |
## Putting the script in /var/backups/mysql seems sensible... on a debian machine that is | |
## Create the user and directories | |
# mkdir -p /var/backups/mysql/databases | |
# useradd --home-dir /var/backups/mysql --gid backup --no-create-home mysql-backup | |
## Remember to make the script executable, and unreadable by others |
license: gpl-3.0 | |
redirect: https://observablehq.com/@d3/zoomable-map-tiles |
master_process on; | |
worker_processes 4; | |
worker_cpu_affinity 0001 0010 0100 1000; | |
worker_priority 0; | |
worker_rlimit_nofile 8192; | |
#error_log logs/error.log; | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; |
Fedora Setup Notes | |
1) If you did not make yourself an administrator during the install, Add yourself to etc/sudoers using the command visudo (allows user to authenticate own account for operations requiring root). | |
a) su, enter root password when prompted | |
b) visudo (use vi for sudo to edit the file following instructions in the file; either add self as a sudo user or enable a group for sudo user and add your self to that group using user group commands) | |
c) ctrl-D (exit root access) | |
d) logout and log back in or restart | |
e) Now you should be able to respond to any prompt requiring root with your own login credentials and be able to run commands using sudo with your own credentials. | |
2) Google Chrome Setup |
L_PREFER_CANVAS = true; | |
leafletData.getMap().then(function(map) { | |
leafletImage(map, function(err, canvas) { | |
var img = document.createElement('img'); | |
var dimensions = map.getSize(); | |
img.width = dimensions.x; | |
img.height = dimensions.y; | |
img.src = canvas.toDataURL(); |
git checkout master | |
git merge develop | |
git push -u origin master |
#!/usr/bin/env python3 | |
import urllib.request | |
import json | |
queryString = 'javascript' | |
ur = 'http://it-ebooks-api.info/v1/' | |
def getFile(urla): | |
response = urllib.request.urlopen(urla) | |
data = json.loads(response.readall().decode('utf-8')) |