Skip to content

Instantly share code, notes, and snippets.

View samir-plusb's full-sized avatar
🏠
Working from home

Samir Rachidi samir-plusb

🏠
Working from home
View GitHub Profile
@tjamps
tjamps / README.md
Last active March 19, 2025 00:30
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 :

@ttscoff
ttscoff / font_grabber.rb
Last active February 20, 2025 09:34
Give it a <link> from Google fonts and get back CSS with fonts embedded
#!/usr/bin/ruby
# encoding: utf-8
# Grab google web fonts and embed them as base64 data URIs
# <http://brettterpstra.com/2015/03/14/embedding-google-web-fonts/>
require 'base64'
if ARGV.length > 0
input = ARGV
elsif STDIN.stat.size > 0
input = STDIN.read.strip.split(/\n+/)
@tofi86
tofi86 / go.sh
Created February 11, 2015 16:51
Mac Shell-Skript für epubMinFlow (http://datenverdrahten.de/epubMinFlow/)
#!/bin/sh
# Bash-Build-Konsolenskript go.sh zum Projekt epubMinFlow
# by Tobias Fischer - http://www.pagina-online.de - 02/2015
# (1) - - - - - - - - - - V o r b e r e i t u n g - - - - - - - - - -
# Ausgangsdokumente (XML bzw. XSLT):
xmlfile="buch.xml"
@cedricziel
cedricziel / README.md
Last active October 27, 2021 08:12
TYPO3 Extension with 3rd part composer dependencies. composer.json is placed in Resources/Private - Updated

Motivation

As long as composer support in CMS is "not there yet", you need to get around somehow.

Say you want to use the (awesome) markdown library, you need a way to get it in.

How

  1. Use a container extension with a private namespace
@pripple
pripple / Configuration-Routes.yaml
Created September 26, 2014 12:36
TYPO3 Neos Google Sitemap
-
name: 'Google Sitemap'
uriPattern: '{node}sitemap.xml'
subRoutes:
'TYPO3NeosSubroutes':
package: 'TYPO3.Neos'
defaults:
'@package': 'TYPO3.Neos'
'@controller': 'Frontend\Node'
'@action': 'show'
@lologhi
lologhi / 1.How to easily implement a REST API with oAuth2 presentation.md
Last active April 4, 2024 22:13
Symfony2 : How to easily implement a REST API with oAuth2 (for normal guys)

It's still a work in progress...

Intro

As William Durand was recently explaining in his SOS, he "didn't see any other interesting blog post about REST with Symfony recently unfortunately". After spending some long hours to implement an API strongly secured with oAuth, I thought it was time for me to purpose my simple explanation of how to do it.

Ok, you know the bundles

You might have already seen some good explanation of how to easily create a REST API with Symfony2. There are famous really good bundles a.k.a. :

@gruppjo
gruppjo / isemptyobject.js
Created July 24, 2014 11:32
angularjs - empty object filter
'use strict';
angular.module('crmApp')
.filter('isEmptyObject', function () {
return function (obj) {
return angular.equals({}, obj);
};
});

create index

curl -XPUT localhost:9200/localnews/ -d @localnews.index.json

create mapping

curl -XPUT localhost:9200/localnews/news_item/_mapping -d @localnews.mapping.json
@denji
denji / README.md
Last active February 11, 2025 10:01 — forked from istepanov/gist:3950977
Remove/Backup – settings & cli for macOS (OS X) – DataGrip, AppCode, CLion, Gogland, IntelliJ, PhpStorm, PyCharm, Rider, RubyMine, WebStorm
@d11wtq
d11wtq / docker-ssh-forward.bash
Created January 29, 2014 23:32
How to SSH agent forward into a docker container
docker run -rm -t -i -v $(dirname $SSH_AUTH_SOCK) -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK ubuntu /bin/bash