Skip to content

Instantly share code, notes, and snippets.

View lykmapipo's full-sized avatar

lally elias lykmapipo

View GitHub Profile
@lykmapipo
lykmapipo / angular_error_interceptor.js
Created December 10, 2015 07:57
Sample snippets to handle angular http errors
.config(function($httpProvider) {
$httpProvider.interceptors.push(['$q', '$rootScope', function($q, $rootScope) {
return {
responseError: function(rejection) {
if (rejection.status === 403) {
$rootScope.$broadcast('403', rejection);
}
return $q.reject(rejection);
}
};
@lykmapipo
lykmapipo / dia_comment_width_fix.md
Created November 26, 2015 09:27
Fixing height of comment section of dia diagram tool in ubuntu

I have fixed it by editing the start script /usr/bin/dia to have the LIBOVERLAY_SCROLLBAR=0 before the dia launch.

$ sudo /usr/bin/dia

Then edit dia file to look as below

#How you get Sail.js running on Openshift#

This instruction is tested with:

  • Sails.js v0.9.16
  • Node.js 0.10 on Openshift ( 05 May 2014)

###1) package.json

If you use the package.json build by sails new Projectname than you have to add a few fields for openshift – so the server can start you app automatically. Sails uses Grunt to build minify css/js and so on. Openshift dont have grunt installed so you have to add this also.

@lykmapipo
lykmapipo / angularjs-providers-explained.md
Last active August 29, 2015 14:26 — forked from demisx/angularjs-providers-explained.md
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

@lykmapipo
lykmapipo / app.js
Last active December 19, 2019 20:29 — forked from jgoux/app.js
Ionic / AngularJS service wrapper for Web SQL API / SQLite-Cordova-Plugin
angular.module('myApp', ['ionic', 'myApp.services', 'myApp.controllers'])
.run(function(DB) {
DB.init();
});
cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin.git
@lykmapipo
lykmapipo / phantomjs-facebook-update.js
Last active August 30, 2018 18:52 — forked from ariefbayu/phantomjs-facebook-update.js
facebook status update using phantomjs
var page = new WebPage();
//spoof it as opera mini, to get the mobile page working properly
page.settings.userAgent = "Opera/9.80 (J2ME/MIDP; Opera Mini/6.5.26955/27.1407; U; en) Presto/2.8.119 Version/11.10";
function doLogin(){
page.evaluate(function(){
var frm = document.getElementById("login_form");
frm.elements["email"].value = "--enter-your-email--";
@lykmapipo
lykmapipo / storeImgInMongoWithMongoose.js
Last active November 8, 2015 17:29 — forked from aheckmann/storeImgInMongoWithMongoose.js
store/display an image in mongodb using mongoose/express
/**
* Module dependencies
*/
var express = require('express');
var fs = require('fs');
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
// img path
@lykmapipo
lykmapipo / mocha_as_cukes.md
Last active August 29, 2015 14:23
Mocha as Cucumber
Feature: get cash from an ATM
  Background:
    Given the ATM has 1000
    And the user John is authenticated
    And the user's account has 5000
  Scenario: success
    When the user asks the ATM for 500
    Then the ATM will have 500
    And the user's account will have 4500
@lykmapipo
lykmapipo / isomorphic_javascript_software_engineer.md
Last active January 26, 2016 16:05
Isomorphic Javascript Software Engineer

MEAN Developer

Isomorphic Javascript Software Engineer

Ubuntu Setup

Version management tool

Dependency management tools