Skip to content

Instantly share code, notes, and snippets.

View tracend's full-sized avatar
🎯
Focusing

✌ Makis Tracend tracend

🎯
Focusing
View GitHub Profile
@tracend
tracend / gist:89c146afde84720d29c8
Created January 8, 2015 13:12
Minimal SSL setup in Node.js for Localhost
// HTTPS
var https = require('https');
var fs = require('fs');
var options = {
key: fs.readFileSync('/Users/{{USER}}/Repositories/Internal/dev/ssl/server.key'),
cert: fs.readFileSync('/Users/{{USER}}/Repositories/Internal/dev/ssl/server.crt'),
requestCert: false,
rejectUnauthorized: false
};
@tracend
tracend / makesites-insider-201502.md
Last active August 29, 2015 14:14
Surviving Virtual Reality #makesites #insider

Surviving Virtual Reality

We've heard the news, we've seen the demos. Now we're wondering how is VR going to affect our lives. Here is an in depth analysis on how the human spirit could cope in a virtual environment... vastly based on our human nature and common psychology rather than scientific predictions.


Some see VR as an ominous reality, recalling images of the Matrix or the Lawnmower man; admittedly mostly non-technical people. At the same time, the tech community is celebrating the innovation and breakthrough technology. No one is even considering the consequences of this technology in our everyday lives, only how it will be applied; a mental blindness much like during the Manhattan Project, making the realization beyond the technical achievement a late afterthought.

Virtual reality by definition is a different reality. It is allowing the p

@tracend
tracend / aws.json
Last active August 29, 2015 14:15
Config schema
{
"key" : "1234567890",
"secret" : "abcdefghijklmnopqrstuvwxyz",
"s3" : {
"bucket" : "",
"path" : "/",
"region" : "us-east-1",
"acl" : "public-read"
},
"hosts" : {
@tracend
tracend / makesites-insider-201503.md
Last active August 29, 2015 14:16
Introducing: Internet, in a can! #makesites #insider

Introducing: Internet, in a can!

Have you ever had that bittersweet feeling of crossing paths with a special someone and knowing that if you don't act now any chance you had to relate will be gone and lost forever? That's where we are, humanity as a whole, facing the Web today...


Despite common belief, the current state of the Web is close to ideal. Not on a technical level but rather its fundamental architecture. The barrier of entry is minimal and there's this concept that the Web is free and embracing of every human expression. This should not be taken for granted. In fact there are very few things in life that can match this level of freedom.

Our lives are mostly regulated and people are channeled to expected behaviors. Corporations rule the real world and under their reign our lives have become comfortable and predictable. This was of course what humanity wanted, to establish order, and it's a task that corporations can excel at; that's why we've promoted them to leaders in our society

Handlebars.registerHelper("prettyDate", function (time) {
var date = new Date((time || "")),
diff = (((new Date()).getTime() - date.getTime()) / 1000),
day_diff = Math.floor(diff / 86400);
// exit now if not a number...
if ( isNaN(day_diff)) return;
if ( day_diff < 0 ){
// this is in the future...
@tracend
tracend / v1.js
Last active August 29, 2015 14:18
Custom BodyParser for Express.js
// V1 - basic parser
// Work around instead of using bodyParser
// Source: http://stackoverflow.com/a/9920700/1247359
parser : function(req, res, next) {
var data='';
req.setEncoding('utf8');
req.on('data', function(chunk) {
data += chunk;
});
@tracend
tracend / app.configure.js
Created April 2, 2015 09:39
app.configure for Express >v3
// FIX: for express 4.x (.configure() removed)
app.configure = function(a, b){
var type, callback;
if( !b ){
callback = a // assume a is a function?
} else {
type = a;
callback = b;
}
// execute...
@tracend
tracend / makesites-insider-201506.md
Last active August 29, 2015 14:21
Components are a-Comin #makesites #insider

Components are a-Comin

Web components have been around for a while and they've been making the rounds in developer circles, showing off their unique properties and potential. Their application in production has had a slow start as we're all still trying to gain familiarity with this new interface and assess how it fits with our current web development process.


Despite the naysayers, the history of the Internet is tightly attached to markup. As the Web has been maturing we've seen the separation of concerns dominating our methodology with CSS becoming the exclusive moderator of styling, layout structure defined solely by markup, JSON structures moving data and JavaScript used for logic. Custom markup is not a new concept, it's what XML supported since its introduction; although its use in that case is fundamentally different, to describe data rather than layout.

Custom markup tags are as straightfo

@tracend
tracend / makesites-insider-201507.md
Last active August 29, 2015 14:23
OS Independence #makesites #insider

OS Independence

Next year will be the year of Linux, said for 2004. Since then we've been up and down the media hub bandwagon, the smartphone revolution and the cloud-based services. So much shuffling around for something so personal; our digital lives.


Back in 2008 I had a second PC that I was rarely using and I thought it would be a good idea to have Linux on it. Even if I was using Linux every day as part of my work, using it on a personal computer would be a good addition...

I guess I'm only mentioning the year because at that time we were right in the midst of the "App Store sensation". Smartphones were the new hot thing and their manufacturers promoted the idea of hardware & software "partnership" to create the "ultimate" experience. Long story short, I bought the hype. After some time I uninstalled Linux on that computer in favor of a proprietary OS. A decision I feel was a mistake in retrospect.

@tracend
tracend / box.js
Last active September 1, 2015 12:30
Web Worker Easing
var Box = function( num, worker ){
this.name = 'box-'+ num;
// create element
var el = document.createElement("div");
el.setAttribute( 'class', 'box' );
el.setAttribute( 'id', this.name );
el.style.top = parseInt(num) * 1 +"px";
document.body.appendChild(el);
this.el = el;
this.state.start = Date.now() || (new Date()).getTime();