In this post, I will introduce a way to deploy a Nginx Reverse Proxy to Openshift base on RedHat certified Nginx Builder Image.
In this post, I will introduce a way to deploy a Nginx Reverse Proxy to Openshift base on RedHat certified Nginx Builder Image.
Minishift allows running a mini-version of Openshift cluster locally for convenience of development and debug. This blog is going through how to run minishift on MacOS.
Installing Node.JS locally will take no more than 5 minutes. This post will go through the steps very quickly.
Node.JS has been attracting attentions for years. What is Node.JS? What makes it unique? Why should developers care about it?
Although Openshift is able to use docker images, it has much more restrictions like no root user. Thus not all docker images can work straight on Openshift. Unfortunately, the official nginx
docker image does not work on openshift.
In this post, I will simply go through how to run this Official RedHat nginx image on Openshift and deploy a website onto it.
Using XMLHTTPRequest
(ajax) transporting data between client and server has been popular for a while. Sometimes, we want our browser to retrieve binary data from server (as ArrayBuffer
or Blob
) such as pdf, image, and psd files. This post will go through how to achieve it with XMLHTTPRequest
and jQuery
.
It is incredibly easy to make a rich web application like psdetch working offline with Service Worker. 5 minutes are all you need!
1 | openssl req -nodes -new -x509 -keyout key.pem -out cert.pem -days 365 |
To setup a brand new raspberrypi zero w you need prepare following tools:
All coneectors can come from seller when you purchase Raspberrypi zero w.
Taking screenshots with MacOSX is very useful when writting blogs or documents. The system has powerful built-in screenshot function. However, the default location to store the screenshot files is Desktop.
This blog will go through how to change the location of screenshots to another folder.
WebWorker has now been supported by majority of browsers (link). I have started to use WebWorkers seriously in my projects (web pages / web apps / cordova mobile apps).
Below reference pages were used while doing my study:
I found this tutorial is relatively simple to follow to create a simple PKI infrastructure
Run docker in docker1
docker run --privileged -i -t -d --restart=unless-stopped -p 2376:2376 -p 10000-11000:10000-11000 -p 10000-11000:10000-11000/udp -v /mnt/opt:/opt:rw -v /etc/docker:/etc/docker:ro -v /mnt/var/lib/docker:/var/lib/docker --name=docker docker:dind -H tcp://0.0.0.0:2376 --storage-driver=aufs --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docker/server-key.pem
Netcat (nc) is very powerful tool. Install apt-get install netcat
Send UDP packet with netcat:1
echo "content goes to server" | nc -u <ip> <port>
e.g.1
2
3
4
5
6
7
8
9
10
11
12
13.select-type-1{
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
padding:1em;
border:1px solid #ee7122;
color:white;
text-align: center;
border-radius: 0px;
-webkit-border-radius: 0px;
background: rgba(255, 255, 255, 0.12) url("../img/arrowdown.png") no-repeat 90% 50%;
background-size:10%;
}
self-explained.
To create an overlay
network on multiple hosts over swarm, following are required:
According to this, do following to determine the client ipaddress:
1 | var ip = (req.headers['x-forwarded-for'] || |
Testing with web app is always fun. Angularjs makes it even better.
This quick note bootstrap any angular.js projects embracing with unit tests.
Unit testing in Angularjs is using (by default) Jasmine and Karma.
Also, angular-mocks needs to be installed. It is needed for injection and some other mock objects.1
bower install --save angular-mocks
According to mongoose.js doc, it is able to set setters to a field on schema.
However, the doc is not quite detailed and obselete.
Some example:1
2
3
4
5
6
7
8
9
10
11var schema=new Schema({
password:{
type:String,
required:true,
set:hash
}
})
function hash(plainPwd){
return require("crypto").createHash("sha1").update(plainPwd).update(secret).digest("hex");
}
Mongodb needs extra collection for two phase lock.1
2
3
4
5
6
7
8
9var transactionSchema=new Schema({
lastModified:Date,
status:{
type:String,
default:"new",
index:true
},
data:{}
})
The transaction life cycle is new->pending->applied->done
When put wordpress blog behind a reverse proxy (e.g. nginx), some headers have to be setup:
1 | proxy_set_header Host $host; |
minimist is a lightweight cli argument (command line arguments) parser:
1 | require('minimist')("-x 3 -y 4 -n5 -abc --beep=boop foo bar baz"); |
1 | -webkit-font-smoothing: antialiased; |
Makes text clearer
In short:
Still don’t know why? Check out use cases here
Switch on / off resize of a textarea on horizontal / vertical / both.1
<textarea style="resize:horizontal"></textarea>
The resize property can be either:
Remove or change style of outline when textarea is focused on safari / chrome etc.1
<textarea class="customize"></textarea>
1 | .customize:focus{ |
Today, I moved my blog from Wordpress to Hexo. I use github.io to host the blog.
The reason I choose Hexo not Jekyll mainly is I am more familiar with Node.js than Ruby so I can write plugins easily.
Hexo is a very powerful static content generator which converts MarkDown posts to Html.
Demo: Click here
Document & API: See Github site for more information.