Skip to content

Instantly share code, notes, and snippets.

View odirleiborgert's full-sized avatar
💻
Working

Odirlei Borgert odirleiborgert

💻
Working
View GitHub Profile
@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);
@oodavid
oodavid / README.md
Last active June 12, 2024 00:28 — 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/
@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);
@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 %}
@rafaelgou
rafaelgou / StringUtil.php
Last active December 22, 2015 05:18
PHP Slug generator class/method
/**
* Description of StringUtil
*
* @author <rafaelgou@gmail.com> Rafael Goulart
*/
class StringUtil {
/**
* Slugify a text and remove accents
*
@novasky-zz
novasky-zz / gist:6885187
Created October 8, 2013 14:03
Habilitar Rewrite Mode no linux.
sudo a2enmod rewrite
sudo service apache2 restart
@novasky-zz
novasky-zz / gist:6933419
Created October 11, 2013 11:51
Para corrigir o problema com espaço em branco no FckEditor
//Arquivo shared/libs/fckconfig.js
FCKConfig.FillEmptyBlocks = false
@novasky-zz
novasky-zz / gist:7213002
Created October 29, 2013 11:30
Dynamic subdomains with cPanel and PHP
# Put * in Subdomains in cPanel to setup Wildcard
# Put this in .htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^([aA-zZ])$ subslug.php?username=$1
RewriteCond %{HTTP_HOST} ^(^.*)\.yourdomain.com
RewriteRule (.*) subslug.php?username=%1
@xthiago
xthiago / README.md
Created December 8, 2013 13:35 — forked from oodavid/README.md

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/
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');