Skip to content

Instantly share code, notes, and snippets.

View ahmadshah's full-sized avatar
:octocat:
Yo!

Ahmad Shah Hafizan Hamidin ahmadshah

:octocat:
Yo!
View GitHub Profile
@ahmadshah
ahmadshah / randomizer.ex
Created September 1, 2016 10:28
Random string in elixir
defmodule Randomizer do
@moduledoc """
Random string generator module.
"""
@doc """
Generate random string based on the given legth. It is also possible to generate certain type of randomise string using the options below:
* :all - generate alphanumeric random string
* :alpha - generate nom-numeric random string
@ahmadshah
ahmadshah / github-stats.md
Created March 29, 2022 14:20
Github Stats

Ahmad Shah Github Stats

@ahmadshah
ahmadshah / componentA.vue
Created June 24, 2016 07:49
Vuejs Event Emitter
<template>
<button @click="emitEvent">EVENT</button>
</template>
<script>
import { EV } from './events'
export default {
methods: {
emitEvent() {
@ahmadshah
ahmadshah / README.md
Last active January 6, 2021 15:21
Ecto Soft Delete

Soft Delete Ecto Repo

The goal is to support soft delete functionality in Ecto.Repo. With the suggestion by @imranismail, another repo is created and the remaining functionalities are delegate to the original MyApp.Repo.

The new repo get/2 and all/1 functions will exclude the soft deleted record by default. delete/1 and delete_all/1 will update the delete_at column by default instead of deleting.

Example

MyApp.Repo.get(MyApp.User, 1) //will return nil if record is in soft delete state
@ahmadshah
ahmadshah / keybase.md
Created October 22, 2019 15:39
keybase.md

Keybase proof

I hereby claim:

  • I am ahmadshah on github.
  • I am ahmadshahhafizan (https://keybase.io/ahmadshahhafizan) on keybase.
  • I have a public key whose fingerprint is D4EC 26F2 4E6C 3E8E 6AD2 A17E 5CFA 083D 429A F81F

To claim this, I am signing this object:

<?php
namespace App\Http\Controllers;
use App\User as UserModel;
class UserController extends Controller
{
public function index()
{
@ahmadshah
ahmadshah / JWT.go
Last active May 31, 2018 15:39
Golang JWT
package auth
import (
"errors"
"time"
jwt "github.com/dgrijalva/jwt-go"
"github.com/jinzhu/gorm"
)
@ahmadshah
ahmadshah / tasks.md
Last active April 1, 2018 07:05
APU Chatbot Workshop

Tasks

  • Make sure you have code editor installed.
  • Make sure Nodejs and NPM is installed and running correctly.
  • Create a new Telegram account and download the desktop/mobile app.
  • Create a new Telegrame bot and grab the access token.
  • Create a new DialogFlow account. https://dialogflow.com
  • Create a new SmallTalk agent and grab the access token.
  • Create a new Firebase account. https://firebase.google.com
  • Create a new Firestore database and a new collection.
@ahmadshah
ahmadshah / Dockerfile
Last active October 10, 2017 18:06
Darknet, OpenCV and Python3 Docker
FROM loretoparisi/darknet:latest
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y build-essential \
libssl-dev \
libffi-dev \
python3-dev \
python3-pip \
libopencv-dev \
defmodule Fashionista.Event.UserIsAuthenticated do
use Fashionista.Service.Kong
import Joken
@response_fields ~w(
username custom_id message secret id algorithm created_at key consumer_id
)
def create_token(email, id) do