Skip to content

Instantly share code, notes, and snippets.

View iamalvisng's full-sized avatar
🏠
Working from home

Alvis Ng iamalvisng

🏠
Working from home
View GitHub Profile
@iamalvisng
iamalvisng / InfiniteScrollTrigger.tsx
Last active August 7, 2023 03:40
Infinite scroll using Intersection Observer API
import React, { useEffect, useRef } from 'react';
// Define the properties for the InfiniteScrollTrigger component
type InfiniteScrollTriggerProps = {
onIntersect: () => void; // Callback function to be executed when intersection is detected
root?: Element | Document | null; // The Element or Document object to be used as the viewable area for the IntersectionObserver
threshold?: number; // A single number or an array of numbers between 0.0 and 1.0 indicating at what percentage of the target's visibility the observer's callback should be executed
rootMargin?: string; // Margin around the root. Can have values similar to the CSS margin property
};
@iamalvisng
iamalvisng / request.js
Created June 11, 2019 01:43 — forked from sheharyarn/request.js
Axios Request Wrapper for React (https://to.shyr.io/axios-requests)
/**
* Axios Request Wrapper
* ---------------------
*
* @author Sheharyar Naseer (@sheharyarn)
* @license MIT
*
*/
import axios from 'axios'
// File: .storybook/config.js
import { configure, addDecorator } from '@kadira/storybook';
import Theme from './../src/ui/theme';
import React from 'react';
import { ThemeProvider } from 'styled-components'
function loadStories() {
require('../stories');
}
@sheharyarn
sheharyarn / request.js
Last active August 24, 2023 14:55
Axios Request Wrapper for React (https://to.shyr.io/axios-requests)
/**
* Axios Request Wrapper
* ---------------------
*
* @author Sheharyar Naseer (@sheharyarn)
* @license MIT
*
*/
import axios from 'axios'
@gokulkrishh
gokulkrishh / media-query.css
Last active June 28, 2024 09:07
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
@donovanh
donovanh / gulpfile.js
Created July 28, 2014 21:01
Gulp file for Jekyll, with Sass, Autoprefixer, and browsersync
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
clean = require('gulp-clean'),
concat = require('gulp-concat'),
notify = require('gulp-notify'),
@staltz
staltz / introrx.md
Last active June 29, 2024 15:58
The introduction to Reactive Programming you've been missing
@MarcDiethelm
MarcDiethelm / Contributing.md
Last active June 12, 2024 19:37
How to contribute to a project on Github

This text now lives at https://github.com/MarcDiethelm/contributing/blob/master/README.md. I turned it into a Github repo so you can, you know, contribute to it by making pull requests.


Contributing

If you want to contribute to a project and make it better, your help is very welcome. Contributing is also a great way to learn more about social coding on Github, new technologies and and their ecosystems and how to make constructive, helpful bug reports, feature requests and the noblest of all contributions: a good, clean pull request.

@adhithyan15
adhithyan15 / countdown.js
Last active May 10, 2024 09:35
A simple countdown timer in Javascript
/********************************************************************************************************************
Countdown.js is a simple script to add a countdown timer
for your website. Currently it can only do full minutes
and partial minutes aren't supported. This script is a fork of http://jsfiddle.net/HRrYG/ with some
added extensions. Since the original code that I forked was released under Creative Commons by SA license,
I have to release this code under the same license. You can view a live demo of this code at http://jsfiddle.net/JmrQE/2/.
********************************************************************************************************************/
function countdown(minutes) {
var seconds = 60;
var mins = minutes
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"