Skip to content

Instantly share code, notes, and snippets.

View aliemre's full-sized avatar
🎯
Focusing

Ali Emre Çakmakoğlu aliemre

🎯
Focusing
  • Webridge
  • İzmir / Türkiye
View GitHub Profile
@jampajeen
jampajeen / LC_CTYPE.txt
Created November 21, 2015 13:02
Centos warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
vi /etc/environment
add these lines...
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
@tjamps
tjamps / README.md
Last active February 29, 2024 14:57
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 :

@xzilla
xzilla / gist:4205488
Created December 4, 2012 16:00
ejs template to remove html tags
create custom filter like so:
ejs.filters.plaintext = function(obj) {
return obj.replace(/(<([^>]+)>)/ig,'');
};
then call it like so:
<%=: item.content.substring(0,94) | plaintext %>