Skip to content

Instantly share code, notes, and snippets.

View olaferlandsen's full-sized avatar
🏠
Aló?

Olaf Erlandsen olaferlandsen

🏠
Aló?
  • Chile
  • 19:31 (UTC -03:00)
View GitHub Profile
@olaferlandsen
olaferlandsen / app.js
Created January 14, 2019 07:57 — forked from daffl/app.js
Feathers Buzzard improved real-time event filtering dispatchers
app.service('messages').dispatch('eventname', (message, hook) => {
// Just dispatch to one user
if(message.isPrivate) {
return app.channel(message.receiver_id);
}
// Returning falsy or nothing will do nothing
});
// Send to a certain room
upstream app_server {
ip_hash;
server app_react:3000 max_fails=3 fail_timeout=30s;
}
upstream api_server {
ip_hash;
server api_feathers:3040 max_fails=3 fail_timeout=30s;
}
@olaferlandsen
olaferlandsen / README.md
Last active November 25, 2018 02:50
Ejercicios base de datos
@olaferlandsen
olaferlandsen / ObjectSchema.js
Last active May 7, 2018 18:53
Create, validate and use "Object Schemas"
window.ObjectSchema = function (value, options, throwError) {
var regexpArray = /(array|\[([\]]+)\])/i;
var finalObject = {};
if (typeof options !== "object" || options === null) return false;
if (typeof value !== "object" || value === null) return false;
var defaultOptions = {type : "string", defaultValue : null, nullable : false};
for (var property in value) {
var v = value[property], o = options[property];
if (property in options) {
o = Object.assign(defaultOptions, o || {});
@olaferlandsen
olaferlandsen / gist:dfea2ca397af198f78daaf52eaf21978
Last active April 16, 2018 15:31
Install node & seting ionic on OSX
brew install nvm
mkdir ~/.nvm
export NVM_DIR="$HOME/.nvm"
. "/usr/local/opt/nvm/nvm.sh"
nvm install node // download, compile and install the latest version of node
// install cordova, ionic and typescript
npm install -g cordova ionic typescript
// setting ios envivorment
npm install -gf ios-deploy --unsafe-perm=true
@olaferlandsen
olaferlandsen / uninstall-node.sh
Last active April 21, 2018 18:16
Uninstall completely nodejs from OSX
sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf /usr/local/include/node_modules
sudo rm -rf /usr/local/bin/node
sudo rm -rf /usr/local/bin/node-debug
sudo rm -rf /usr/local/bin/node-gyp
sudo rm -rf ~/.npmrc
sudo rm -rf ~/.npm
sudo rm -rf ~/.node-gyp
sudo rm -rf ~/.node_repl_history
sudo rm -rf ~/node_modules
@olaferlandsen
olaferlandsen / app.module.ts
Last active October 20, 2017 13:24
Directiva para formatear RUT en Ionic2
@NgModule({
declarations: [
//...
IonRutDirective
//...
]
})
@olaferlandsen
olaferlandsen / android_instructions.md
Created March 15, 2017 19:06 — forked from patrickhammond/android_instructions.md
Easily setup an Android development environment on a Mac

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

@olaferlandsen
olaferlandsen / ngNumber.js
Last active December 16, 2016 13:56
ngNumber - Simple and powerful directive for allow only numbers on text input.
/**
* How to use it?
* You only need set 'ng-number' attribute on you input like
Example:
* <input ng-model="myModel" ng-number>
*
* How to integrate?
* You need copy this code and paste after you module definition on you Angular app.
* Example:
* module('controllers', [])