Skip to content

Instantly share code, notes, and snippets.

View mazhar266's full-sized avatar
💭
I may be slow to respond.

Mazhar Ahmed mazhar266

💭
I may be slow to respond.
View GitHub Profile
@faisalmahmud
faisalmahmud / gist:e4c44c0dacacf01515dea1643929fcdb
Created May 15, 2017 06:03
Good starting point for a Django dev environment on Ubuntu
sudo apt-get update
sudo apt-get upgrade
# Install packages
sudo apt-get install -y python-pip python-dev build-essential python-software-properties
sudo apt-get install -y git-core htop nginx ntpdate nano ufw curl wget
sudo apt-get install -y zlib1g-dev libssl-dev libreadline-dev libyaml-dev libxml2-dev libxslt1-dev libcurl4-openssl-dev
sudo apt-get install -y libsqlite3-dev sqlite3
sudo apt-get install -y redis-server
sudo apt-get install -y nodejs npm
@nixon1333
nixon1333 / banglaNumber.js
Created February 22, 2016 09:53
English number to Bangla number convertion
function toBangla (str)
{
//check if the `str` is not string
if(!isNaN(str)){
//if not string make it string forcefully
str = String(str);
}
//start try catch block
try {
@sergejmueller
sergejmueller / ttf2woff2.md
Last active March 9, 2024 13:37
WOFF 2.0 – Learn more about the next generation Web Font Format and convert TTF to WOFF2
@danvbe
danvbe / 1-Explanations.md
Last active April 21, 2023 15:39
A way to integrate FosUserBundle and HWIOAuthBundle

I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:

  • the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
  • set the service for oauth_user_provider in the security.yml with your custom created service

Here are the steps:

  1. Routing. In routing.yml I have added all the routes for both bundles.
  2. Configuration. I have set the config.yml mostly as it is presented in the HWIOAuthBundle.
  3. Security. I have set the security.yml mostly as it is presented in the HWIOAuthBundle (though my routes are using /login pattern, not /connect). Also, the oauth_user_provider is set for my custom service.
@mazhar266
mazhar266 / UTF8_STRLEN.php
Created February 18, 2012 09:55
strlen of utf8 unicode characters
<?php
function utf8_strlen ($s)
{
$c = strlen($s); $l = 0;
for ($i = 0; $i < $c; ++$i)
if ((ord($s[$i]) & 0xC0) != 0x80)
++$l;
return $l;
}