Skip to content

Instantly share code, notes, and snippets.

View dassiorleando's full-sized avatar

Orleando Dassi dassiorleando

View GitHub Profile
<?php
namespace NoxLogic\DemoBundle\Form\Type;
use Doctrine\ORM\EntityManager;
use NoxLogic\DemoBundle\Entity\Province;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
@dassiorleando
dassiorleando / README.md
Created October 30, 2016 09:36 — forked from tjamps/README.md
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authentication
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :

@dassiorleando
dassiorleando / Heroku-RoR.md
Created March 12, 2017 08:09
Simple instructions to deploy a ruby on rails app to heroku

Push Your RoR app To Heroku

Simple Config To Push Your RoR app To Heroku using Pg:

  • Let sqlite just in development & test environment
group :development, :test do
 gem 'sqlite3', '1.3.12'
end
@dassiorleando
dassiorleando / app.js
Created December 11, 2017 18:33 — forked from JuanJo4/app.js
Twitter OAuth with node-oauth for node.js + express 4
/*
Node.js, express, oauth example using Twitters API
Install Dependencies:
npm install express
npm install oauth
Create App File:
Save this file to app.js
@dassiorleando
dassiorleando / gist:254b6f10200c83e57c50cc872be4a723
Created March 7, 2018 05:12
Illustrate the use of $timeout and setTimeout with AngularJs
/**
* Simple script to show how to solve the scrope update
* When using the native js TimeOut call
*
* @author dassiorleando
*/
(function (angular) {
'use strict';
angular
@dassiorleando
dassiorleando / script.js
Last active March 24, 2018 08:11
Using $timeout and setTimout in AngularJs App
/**
* Simple script to show how to solve the scrope update
* When using the native js TimeOut call
*
* @author dassiorleando
*/
(function (angular) {
'use strict';
angular
@dassiorleando
dassiorleando / valueIOf.java
Created April 3, 2018 10:28
a part of valueOf method
/**
* Returns the string representation of the {@code Object} argument.
*
* @param obj an {@code Object}.
* @return if the argument is {@code null}, then a string equal to
* {@code "null"}; otherwise, the value of
* {@code obj.toString()} is returned.
* @see java.lang.Object#toString()
*/
public static String valueOf(Object obj) {
public class ObjectB {
private String propB;
public ObjectB(String propB) {
this.propB = propB;
}
// Getters and setters
@Override
public class ObjectA {
private String propA;
private ObjectB objectB1;
private ObjectB objectB2;
public ObjectA(String propA, ObjectB objectB1) {
this.propA = propA;
this.objectB1 = objectB1;
}
ObjectB objectB = new ObjectB("Fake propB");
ObjectA objectA = new ObjectA("Fake propA", objectB);
System.out.println(Objects.toString(objectA));