Skip to content

Instantly share code, notes, and snippets.

View azmanabdlh's full-sized avatar
🔥
Focus

Azman Abdullah azmanabdlh

🔥
Focus
View GitHub Profile
@azmanabdlh
azmanabdlh / main.go
Last active January 30, 2024 06:23
new callwrapper
package main
import "fmt"
func main() {
cw := NewCallWrapper()
var dataStruct string
cw.SetOptions(
WithRedis("redis", 1000, dataStruct),
@azmanabdlh
azmanabdlh / multipart_upload.go
Created September 30, 2022 22:47 — forked from mattetti/multipart_upload.go
Example of doing a multipart upload in Go (golang)
package main
import (
"bytes"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"os"
@azmanabdlh
azmanabdlh / file-upload-multipart.go
Created August 27, 2022 04:07 — forked from andrewmilson/file-upload-multipart.go
Golang multipart/form-data File Upload
package main
import (
"net/http"
"os"
"bytes"
"path"
"path/filepath"
"mime/multipart"
"io"
@azmanabdlh
azmanabdlh / react-native-animated_twitter-profile.jsx
Created December 15, 2021 14:45 — forked from eveningkid/react-native-animated_twitter-profile.jsx
React Native Animated: Twitter Profile Example
// Expo SDK41
// expo-blur: ~9.0.3
import React, { useRef } from 'react';
import {
Animated,
Image,
ImageBackground,
ScrollView,
StatusBar,
@azmanabdlh
azmanabdlh / client.js
Created January 27, 2021 19:43 — forked from crtr0/client.js
A simple example of setting-up dynamic "rooms" for socket.io clients to join
// set-up a connection between the client and the server
var socket = io.connect();
// let's assume that the client page, once rendered, knows what room it wants to join
var room = "abc123";
socket.on('connect', function() {
// Connected, let's sign-up for to receive messages for this room
socket.emit('room', room);
});
@azmanabdlh
azmanabdlh / .gitlab-ci.yml
Created December 30, 2020 15:02 — forked from superjose/.gitlab-ci.yml
This is an example of a .gitlab-ci.yml that is required for Continuous Integration on GitLab projects.
# Reference: https://www.exclamationlabs.com/blog/continuous-deployment-to-npm-using-gitlab-ci/
# GitLab uses docker in the background, so we need to specify the
# image versions. This is useful because we're freely to use
# multiple node versions to work with it. They come from the docker
# repo.
# Uses NodeJS V 9.4.0
image: node:9.4.0
# And to cache them as well.
@azmanabdlh
azmanabdlh / service-worker.js
Created December 26, 2020 12:41 — forked from JMPerez/service-worker.js
An example of a service worker for serving network first, cache second
// the cache version gets updated every time there is a new deployment
const CACHE_VERSION = 10;
const CURRENT_CACHE = `main-${CACHE_VERSION}`;
// these are the routes we are going to cache for offline support
const cacheFiles = ['/', '/about-me/', '/projects/', '/offline/'];
// on activation we clean up the previously registered service workers
self.addEventListener('activate', evt =>
evt.waitUntil(
@azmanabdlh
azmanabdlh / force-reload.js
Created December 26, 2020 07:52 — forked from kawazoe/force-reload.js
Auto refresh page on manifest.json change. iOS offline PWA hack to handle auto updates.
// ------------------------------------------- IMPORTANT -------------------------------------------
// This is a development file to be minified using https://javascript-minifier.com/ and inlined in
// the index.html file. This file is not compiled or processed by webpack so it should be treated as
// low-level precompiled es5-compatible javascript. The code here is not meant to be clean, it's
// meant to be as light and fast as possible since it runs in the head tag.
// HACK: This file a hack to ensure that home-screen apps on mobile devices gets refreshed when they
// start. It works by forcing a load of the service-worker.js file and use the precache-manifest
// file name as an application version, just like a desktop browser like chrome would do. When
// when it detects a change in the application version, it reloads the page and bypass the browser's