Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# verify membership in the www group
groups
# change the group overship
sudo chown -R root:www /var/www
# change the directory premissions
sudo chmod 2775 /var/www
@barmatz
barmatz / ec2-install-lamp-part-1
Created November 11, 2016 12:39
The following procedures help you install the Apache web server with PHP and MySQL support on your Amazon Linux instance
#!/bin/bash
# update yum
sudo yum update -y
# install Apache web server, MySQL, and PHP
sudo yum install -y httpd24 php56 mysql55-server php56-mysqlnd
# start the Apache web server
sudo service httpd start
@barmatz
barmatz / x-modal.js
Created September 30, 2015 21:20
Ember Bootstrap Modal
(function () {
'use strict';
App.XModalComponent = Ember.Component.extend({
title: null,
backdrop: true,
keyboard: true,
propertiesDidChange: Ember.observer('backdrop', 'keyboard', function () {
this.refresh();
}),
@barmatz
barmatz / request.js
Created September 21, 2015 18:52
JavaScript XHR promise wrapper for Ember
function request(method, url, data) {
var defferred, xhr;
if (!data) {
data = {};
}
defferred = new Ember.RSVP.Promise(function (resolve, reject) {
xhr = Ember.$.ajax({
method: method,
@barmatz
barmatz / error-parser.js
Last active September 22, 2015 10:05
JavaScript error parser
function errorParser(err) {
if (err) {
if (typeof err === 'function') {
err = err();
}
if (typeof err === 'object') {
if ('responseText' in err) {
err = err.responseText;

Keybase proof

I hereby claim:

  • I am barmatz on github.
  • I am barmatz (https://keybase.io/barmatz) on keybase.
  • I have a public key whose fingerprint is 1A2B 7EE8 CA84 EBF8 129D 0261 9661 EA48 3EFB 099D

To claim this, I am signing this object:

@barmatz
barmatz / Gruntfile.js
Created July 9, 2015 09:32
Node ES6 Ember Project
'use strict';
module.exports = function (grunt) {
grunt.initConfig({
clean: {
app: '.tmp/**'
},
compass: {
app: {
options: {
@barmatz
barmatz / logger.js
Last active January 23, 2018 14:47
Basic Express server
const { Logger, transports: { Console } } = require('winston');
module.exports = new ]Logger({
transports: [
new Console({
colorize: true,
level: process.env.NODE_ENV === 'development' ? 'silly' : 'info'
})
]
});
@barmatz
barmatz / singleton.js
Created December 10, 2014 12:12
Node.js Singleton pattern
'use strict';
var singletonLock = {},
instance;
function MySingleton(lock) {
if (!(lock instanceof singletonLock)) {
throw new Error('This is a singleton, do not initiate!');
}
}
@barmatz
barmatz / CutomError.js
Last active August 29, 2015 14:08
NoseJS custom error
'use strict';
var inherits = require('util').inherits;
function CustomError(message) {
Error.captureStackTrace(this, CustomError);
this.message = message;
}