Skip to content

Instantly share code, notes, and snippets.

View odirleiborgert's full-sized avatar
💻
Working

Odirlei Borgert odirleiborgert

💻
Working
View GitHub Profile
@novasky-zz
novasky-zz / gist:6010529
Created July 16, 2013 16:58
Loop For, Condição IF e Operador Ternário no Twig
{# Laço de repetição de array #}
{% for fruta in listFrutas %}
- {{fruta.nome}} <br>
{% endfor %}
or
{% for i in 0..10 %}
{# Laço de repetição #}
{% for i in 1..10 %}
@novasky-zz
novasky-zz / gist:5730900
Last active July 5, 2016 18:58
Paginação com Doctrine 2?
<?php
$page = 1; // Página Atual
$numByPage = 5; // Número de registros por Página
$Empresa = $em->createQuery("SELECT e FROM Empresa e ")
->setFirstResult( ( $numByPage * ($page-1) ) )
->setMaxResults( $numByPage );
$Empresa = new \Doctrine\ORM\Tools\Pagination\Paginator($Empresa);
@oodavid
oodavid / README.md
Last active March 11, 2025 21:41 — forked from aronwoost/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@charlesdaniel
charlesdaniel / basic_auth_nodejs_test.js
Created January 27, 2012 02:53
Example of HTTP Basic Auth in NodeJS
var http = require('http');
var server = http.createServer(function(req, res) {
// console.log(req); // debug dump the request
// If they pass in a basic auth credential it'll be in a header called "Authorization" (note NodeJS lowercases the names of headers in its request object)
var auth = req.headers['authorization']; // auth is in base64(username:password) so we need to decode the base64
console.log("Authorization Header is: ", auth);