Skip to content

Instantly share code, notes, and snippets.

View ahmed-hamdy90's full-sized avatar

ahmed hamdy ahmed-hamdy90

  • Idealratings. Ltd
  • Cairo, Egypt
View GitHub Profile
@JonCole
JonCole / Redis-BestPractices-General.md
Last active April 27, 2024 12:50
Redis Best Practices

Some of the Redis best practices content has moved

This content from this markdown file has moved a new, happier home where it can serve more people. Please check it out : https://docs.microsoft.com/azure/azure-cache-for-redis/cache-best-practices.

NOTE: Client specific guidance listed below is still valid and should still be considered. I will update this document once all content has been moved.

@bryanstern
bryanstern / OkHttpStack.java
Last active April 24, 2022 03:17
An OkHttp backed HttpStack for Volley
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Circle Internet Financial
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@danharper
danharper / gulpfile.js
Last active April 11, 2024 08:31
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
@bettysteger
bettysteger / config.js
Last active August 27, 2018 06:24
Angular $httpProvider interceptor to handle requests and also cancels request on state change
/**
* This array is needed for canceling requests when changing the state/route.
* @type {Array}
*/
var currentRequests = [];
/**
* Handles route changes.
*/
app.run(['$rootScope', function($rootScope) {
@fada21
fada21 / PicassoBigCache.java
Last active March 14, 2018 10:34
Disk cache larger size for Picasso OkHttp (use like PicassoBigCache.INSTANCE.getPicassoBigCache(ctx) -> rest as in regular Picasso api .
package com.?
import java.io.File;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Build;
import android.os.StatFs;
import com.squareup.picasso.Downloader;
@tschaub
tschaub / AngularStyle.md
Last active December 20, 2016 15:28
Opinionated whitespace guide for AngularJS modules

AngularJS Whitespace Guide

The purpose of this style guide is to suggest formatting conventions for AngularJS modules that result in readible, maintainable, and lint free code (see the linter configurations for JSHint and gjslint.py.

All-in-one example

Typically, an AngularJS application would be structured with many modules in separate files. The example below shows a monolithic module to illustrate the formatting conventions for various module methods.

angular.module('module.name', [
@julianshen
julianshen / CircleTransform.java
Last active November 6, 2023 12:47
CircleTransform for Picasso
/*
* Copyright 2014 Julian Shen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@ficusk
ficusk / GsonRequest.java
Last active April 9, 2024 09:03
A Volley adapter for JSON requests that will be parsed into Java objects by Gson.
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;
@samsonasik
samsonasik / gist:3988701
Created October 31, 2012 17:57
Send HTML Mail Using ZF2
use Zend\Mail\Message;
use Zend\Mail\Transport\Smtp as SmtpTransport;
use Zend\Mime\Message as MimeMessage;
use Zend\Mime\Part as MimePart;
use Zend\Mail\Transport\SmtpOptions;
//////////
$message = new Message();
@samsonasik
samsonasik / formselectinzf2
Created September 20, 2012 04:29
Form Select in ZF2
namespace SampleModule\Form;
use Zend\Form\Form;
class SampleForm extends Form
{
public function __construct($name = null)
{
parent::__construct('Sample Form');