Skip to content

Instantly share code, notes, and snippets.

View mrhammadasif's full-sized avatar
😍
In love with JS

Hammad Asif mrhammadasif

😍
In love with JS
View GitHub Profile
@mrhammadasif
mrhammadasif / my.css
Created January 22, 2016 09:22 — forked from anonymous/my.css
CSS Gradient Animation
background: linear-gradient(313deg, #000000, #5f5f5f);
background-size: 400% 400%;
-webkit-animation: AnimationName 16s ease infinite;
-moz-animation: AnimationName 16s ease infinite;
-o-animation: AnimationName 16s ease infinite;
animation: AnimationName 16s ease infinite;
@-webkit-keyframes AnimationName {
    0%{background-position:0% 61%}
    50%{background-position:100% 40%}
    100%{background-position:0% 61%}
@mrhammadasif
mrhammadasif / DisableHome.java
Created February 1, 2016 11:53 — forked from Epsiloni/DisableHome.java
Disabling Android Home Button (It's not 100% there, but using immersive on KitKat should make it work much better)
package com.example.app;
import android.app.Activity;
import android.app.ActionBar;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@mrhammadasif
mrhammadasif / ParallaxPageTransformer.java
Created April 25, 2017 07:45 — forked from Aracem/ParallaxPageTransformer.java
Parallax transformer for ViewPagers that let you set different parallax effects for each view in your Fragments.
package com.aracem.utils.animations.pagetransformation;
import org.jetbrains.annotations.NotNull;
import android.support.v4.view.ViewPager;
import android.view.View;
import java.util.ArrayList;
import java.util.List;
@mrhammadasif
mrhammadasif / book.js
Last active June 21, 2017 10:27
Load Dynamic Routes Recursively in ExpressJS App
// A file in `routes/` folder
module.exports = (function(app, router){
router
.route('/books')
.get((req, res, next)=>{
if(err){
next(err);
// send it to error handler
}
@mrhammadasif
mrhammadasif / SineWaveAnimation.cs
Created December 15, 2017 07:19
Function to Animate the object in Unity (in sinewave animation)
using UnityEngine;
public class SineWaveAnimation : MonoBehaviour {
public float baseSize = 1f;
void Update() {
float animation = baseSize + Mathf.Sin(Time.time * 8f) * baseSize / 7f;
transform.localScale = Vector3.one * animation;
}
}
@mrhammadasif
mrhammadasif / BetterJump.cs
Created December 15, 2017 13:29
BetterJump in Unity
using System.Collections;
using UnityEngine;
public class BetterJump : MonoBehaviour {
public float FallMultiplier = 2.5f;
public float lowJumpMultiplier = 2f;
RigidBody2D rb;
@mrhammadasif
mrhammadasif / adaptive-payment-paypal-example.php
Created November 21, 2018 09:45
Adaptive Payment Paypal Example
<?php
class PayPal {
private $config;
private $urls = array(
"sandbox" => array(
"api" => "https://svcs.sandbox.paypal.com/AdaptivePayments/",
"redirect" => "https://www.sandbox.paypal.com/webscr",
),
"live" => array(
@mrhammadasif
mrhammadasif / gulp-plugin.js
Created February 13, 2019 11:02
gulp plugin for .env files
const through = require("through2")
function changeEnvToDev(val) {
return through.obj(function(file, encoding, callback) {
if (file.isNull()) return callback(null, file)
if (file.isStream()) {
//file.contents = file.contents.pipe(...
//return callback(null, file);
this.emit("error", new Error("Streams not supported!"))
@mrhammadasif
mrhammadasif / cheetay-order-response.json
Created March 13, 2020 12:00
Cheetay response for tracking order
{
"category": "food",
"meter_states": {
"quality_control": "status-pending",
"preparing": "status-current",
"on_the_way": "status-pending"
},
"delivery_time": "25",
"is_food_order": true,
"date_received": "2020-03-13 01:52:01 PM",
@mrhammadasif
mrhammadasif / check-version.js
Created July 28, 2020 13:34
Version Management for Vue SPA application to see for outdated content
import compareVersions from 'compare-versions';
fetch(process.env.BASE_URL + `version.json?_d=` + encodeURI(new Date().toJSON()), {
method: "GET",
headers: {
"pragma": "no-cache",
"cache-control": "no-store"
}
})
.then(resp => resp.json())
.then(json => {