Skip to content

Instantly share code, notes, and snippets.

View oprearocks's full-sized avatar
🏖️
AFO — Away From the Office

Adrian Oprea oprearocks

🏖️
AFO — Away From the Office
View GitHub Profile
@oprearocks
oprearocks / gist:11500164
Last active August 29, 2015 14:00
Object literal vs. constructor -- proof of concept
/**
* Single object -- object literal
*/
var db = {
host: 'localhost',
dbname: 'myDB',
credentials: {
username: 'dbuser',
password: 'dbpassword'
},
@oprearocks
oprearocks / promise-error-handling
Created February 19, 2015 21:58
Error handling in promise-based logic -- when to process.exit and when not to
// In NodeJS I usually have this in it's own module, and use module.exports to expose it.
var errors = {
failure : {
action : function(error) {
// Handle error and set some defaults
console.warn('FAILURE: ' + error.message); // process.stdout.write(error.message);
}
},
fatal : {
@oprearocks
oprearocks / gitworkflow
Created February 23, 2015 14:47
Git usage and resources
## Git Training
Research possible workflows
Propose git book & StackOverflow
### SVN similarities
https://www.atlassian.com/git/workflows
### Well explained workflow
http://documentup.com/skwp/git-workflows-book
http://git-scm.com/book/en/Distributed-Git
@oprearocks
oprearocks / backbonejs-notes
Created February 25, 2015 22:08
BackboneJS feedback
[BackboneJS](http://backbonejs.org/)
==============================
Philosophy
-------------
BackboneJS is a lightweight LIBRARY aimed to offer developers the ability to structure their front-end code into a more MVC-oriented way.
Description
-------------
Backbone is considered MVC, but the C stands for Collection. Unlike other frameworks (MVVM, MVWhatever), Backbone is closer to the classical MVC structure, as it offers the developer the possibility to roll their own _Controller_ and have the proper _C_ in place.
#!/usr/bin/env bash
#
# Cleanup temporary files on a Linux Mint 15 Olivia installation.
#
# This script will happily wipe all root/user temporary files, old kernels,
# browser caches and cpan/cpanm build directories. Review before running
# blindly.
#
# Though, so far, there are no Linux Mint 15 Olivia specific cleanups here,
# this script ensures, that we're really running under this distribution. Feel
@oprearocks
oprearocks / gte-setup
Created March 11, 2015 18:14
GetTheEvent Docker image installation
# Docker image installation
## Installing [docker](https://www.docker.com/)
In order to install the dev environment, you first need to have Docker installed on your system. Navigate to the following url: https://docs.docker.com/installation/ look for your OS name in the list, and perform the setup following closely the steps outlined in the installation guide.
Please note that you should accept the full `boot2docker` installation as you will need all the tools that the installer has to offer -- especially VMWare.
In order to actually run the application, you need to build the image first(it will only happen once, and it will take a while — 5-20 min depending on your system configuration and network connection).
To be able to run the application inside a container, please save the archive that you received in a directory inside `c:/Users/<yourusername>` as `boot2docker` is nice enough to mount this inside your virtual machine, and have it available for you as `/c/<yourusername`.
@oprearocks
oprearocks / es6_template_literals.js
Last active February 29, 2016 12:15
[ARTICLE] /serializing-object-methods-with-es6-template-literals-and-eval
//ES6 template strings
let someComputedValue = 5 + 3;
let theTemplate = `This is the result of the computation: ${someComputedValue}`;
console.log(theTemplate);
// "This is the result of the computation: 8"
// ES5 version
var someComputedValue = 5 + 3;
var theTemplate = 'This is the result of the computation: ' + someComputedValue;
@oprearocks
oprearocks / 1.sh-session
Last active September 20, 2019 00:17
An SSH workflow that's easier on your brain
# List all information about the config file, under the ssh/ directory
adrian@zen ~/D/blog> ls -al ~/.ssh/config
-rw-r--r-- 1 adrian staff 210 Mar 1 13:59 /Users/adrian/.ssh/config
# If you get "No such file or directory [...]", run the command below
adrian@zen ~/D/blog> touch ~/.ssh/config
# Check again, to see if the file has been properly created
adrian@zen ~/D/blog> ls -al ~/.ssh/config
-rw-r--r-- 1 adrian staff 0 Mar 1 17:12 /Users/adrian/.ssh/config
@oprearocks
oprearocks / serialisation.js
Last active May 26, 2016 10:45
Object method serialisation while keeping the `this` reference intact
'use strict';
let person = {
name: 'Adrian',
age: 28,
sayName: function() {
console.log(`My name is ${this.name}`);
console.log(this); // this should log out our `person` object
}
};