Skip to content

Instantly share code, notes, and snippets.

View maykonmeier's full-sized avatar

Maykon Ricardo Meier maykonmeier

View GitHub Profile
@maykonmeier
maykonmeier / NetworkConnection.cs
Created January 17, 2017 13:05
C# Class for creating a network connection using a different network credential
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Net;
public class NetworkConnection : IDisposable
{
readonly string _networkName;
public NetworkConnection(string networkName, NetworkCredential credentials)
@maykonmeier
maykonmeier / view.phtml
Created December 3, 2012 16:16
Access another view, setTerminal true set view without layout. You can remove this method.
$htmlViewPart = new ViewModel();
$htmlViewPart->setTerminal(true)
->setTemplate('address/address/edit')
->setVariables(array('form' => $form));
$htmlOutput = $this->getServiceLocator()
->get('viewrenderer')
->render($htmlViewPart);
return $htmlOutput;
@maykonmeier
maykonmeier / README.md
Last active August 29, 2015 14:25
Practicing Java + Spring

Job request

You should develop an API which has this features:

  1. Should be a DispatcherServlet
  2. Should use Spring 3 (3.1 or 3.2)
  3. Should have a filter for only logged routes (described below)
  4. Only login page could be accessible without login
  5. Hibernate is optional but is a suggestion
  6. Should use maven (v3.0.5)
<?php
/* Working with dates
*
* 1. Everytime work with an object of type DateTime
* 2. Just use String into views or frontend using a format type
*
*/
$format = 'Y-m-d';
@maykonmeier
maykonmeier / tags
Created August 27, 2014 02:47
PHP Tags
<?php echo "Tag 1"; ?>
<? echo false; ?>
<?= "Para views!" ?>
@maykonmeier
maykonmeier / gist:0b2dcc6757edcf5d0930
Last active August 29, 2015 14:04
PHP inner HTML
<html>
<head>
<meta charset="utf-8" />
<meta name="description" content="short page description, to improve search engines">
<meta name="keywords" content="short keywords, separated by comma">
<title>My blog</title>
</head>
<body>
<h1>
<?php echo 'Meu nome é: '; ?>
@maykonmeier
maykonmeier / gist:ef7cc6d19be48d706dd2
Last active August 29, 2015 14:04
Inline comment
<?php
class Post
{
public function getPost()
{
// Inline comment
$a = 10;
// This method will return an int 10
@maykonmeier
maykonmeier / gist:71ee012fe944c5bd5307
Last active August 29, 2015 14:04
Variables - Basic types
<?php
// Boolean
$foo = true;
echo $foo;
// Integer
$width = 1024;
$height = 768;
@maykonmeier
maykonmeier / gist:39f87d90dd992e225558
Last active August 29, 2015 14:04
Array and Object type
<?php
// Array
$fruits = array('Apple', 'Orange', 'Pineapple');
// Array key-value
$data = array(
'first_name' => 'Maykon',
@maykonmeier
maykonmeier / gist:46f0e27cfe7bf457230b
Last active August 29, 2015 14:04
Operadores aritméticos
<?php
// Soma
$a = 1 + 2;
$total = $a - 1;
// Total is 2
// Negacão
$b = -$a;