Skip to content

Instantly share code, notes, and snippets.

View mfdeveloper's full-sized avatar
🕹️
Creating games and mobile apps, every day!

Felipe Michel mfdeveloper

🕹️
Creating games and mobile apps, every day!
View GitHub Profile
@mfdeveloper
mfdeveloper / my_model.rb
Last active August 29, 2015 14:15
Rails - Model with a findAll using multiple conditions
class MyModel < ActiveRecord::Base
attr_acessible :name, :value, :role_id
# Another strategy: multiple conditions with
# multiple ActiveRecord::Relation#where() method calls
def recipients(offset=0, limit=100, data = {})
result = self.order(:id).offset(offset).limit(limit).where('value IS ?', nil)
@mfdeveloper
mfdeveloper / README.md
Last active August 29, 2015 14:16
Ruby Structs and sintax for >= 2.0 features of language

Ruby Structs and Ruby 2.0+ features

In this snippets with code ruby, you will see the sintax of create Structs and some Ruby 2.0+ features. The features are showed:

Ruby 2.0+ features

  • **keyargs and labelled params

Structs

@mfdeveloper
mfdeveloper / Gemfile
Last active August 29, 2015 14:22
Ruby Meta Programming
source 'https://rubygems.org'
gem 'rspec', require: false, group: :test
gem 'simplecov', require: false, group: :test
@mfdeveloper
mfdeveloper / INSTALLATION_GUIDE.md
Last active November 5, 2015 13:49
Monodevelop latest version installation guide and template files on Debian/Ubuntu

MonoDevelop 5.x - Installation Guide

Author: Michel Felipe

  1. Download and install latest mono runtime. Follow the instructions here: Install mono on Debian, Ubuntu, and derivatives

  2. Clone the latest version from MonoDevelop github repo.

git clone git@github.com:mono/monodevelop.git
@mfdeveloper
mfdeveloper / test.js
Created May 5, 2016 19:44
inquirer-npm-name unit test initial changes but doesn't works. Needs verify if is necessary use of "mocha" or "chai" npm packages
describe('npm validation logic (inquirer `when` function)', function () {
beforeEach(function () {
askName2 = proxyquire('../lib', {
'npm-name': function(name){
return Promise.resolve(name == 'yo');
}
});
it('ask question if npm name is taken', function (done) {
this.inquirer.prompt.returns(Promise.resolve({name:'yo'}));
@mfdeveloper
mfdeveloper / component-test.ts
Last active October 9, 2016 10:05
Ionic2-Boilerplate: Angular2 Unit test (still needs changes)
import { DebugElement, Type } from "@angular/core";
import { Predicate } from "@angular/core/src/facade/collection";
import { TestBed, ComponentFixture } from '@angular/core/testing';
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
import { App, MenuController, NavController, Platform, Config, Keyboard, GestureController, Form, IonicModule } from 'ionic-angular';
import { mockNavController, mockPlatform } from 'ionic-angular/util/mock-providers';
import { ConfigMock, MenuControllerMock, KeyboardMock, GestureControllerMock, FormMock } from './mocks';
/**
* @ngdoc object

Composer PHP: Wordpress plugin local path

To reference to a local path reference to a wordpress plugin, using Composer, you need do:

In your WP project/source

  1. Add a repository pointing to local path (absolute or relative) like the composer.json

  2. Add a installer-paths key to move to a specific folder when install the plugin, only if the target plugin contains contains a composer.json with type "wordpress-plugin"

public class AndroidWebview extends CordovaWebView {
/**
* Use webview.sendJavascript is deprecated in latest cordova-android
* Insteadof, pass a JS callback like a success function in cordova.exec()
* cordova plugin JS Bridge, and execute a callbackContext.sendPluginResult(result);
* in Java.
*
* Use this, only if you wish call JS from Java webview/cordova app in old
@mfdeveloper
mfdeveloper / README.md
Last active May 6, 2019 01:51
Ruby Modules

Ruby Modules

Here you will find examples of modules in ruby code. The structure is strong, very important and commonly used by ruby developers! Modules can be used like namespaces or mixins (adds new methods to a class).

Namespaces

In ruby code it's common see something like this:

MyModule::MyClass

The character :: is a namespace separator. A dot '.' can be used to, but it's not recommended.

// This is a working .gradle file for cordova-plugin-fcm-with-updated plugin,
// to use with cordova-android 6.3.0
def FCM_CORE_VERSION = System.getenv("FCM_CORE_VERSION") ?: '16.0.9'
def FCM_VERSION = System.getenv("FCM_VERSION") ?: '18.0.0'
buildscript {
repositories {
mavenCentral()
jcenter()