Skip to content

Instantly share code, notes, and snippets.

View ammein's full-sized avatar

Amin Shazrin ammein

  • Revenue Monster Sdn Bhd
  • Malaysia
  • X @ammein
View GitHub Profile
@mathewbyrne
mathewbyrne / slugify.js
Created October 12, 2011 04:34
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@lancejpollard
lancejpollard / meta-tags.md
Created March 5, 2012 13:54
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@brumm
brumm / bookmarklet.js
Last active December 19, 2023 03:51
Find out which element is scrolling
javascript:!function() { var slice = Array.prototype.slice; function throttle(type, name, obj) { obj = obj || window; var running = false; var func = function() { if (running) { return; } running = true; requestAnimationFrame(function() { obj.dispatchEvent(new CustomEvent(name)); running = false; }); }; obj.addEventListener(type, func); } slice .call(document.querySelectorAll("*")) .filter( e => e.scrollWidth > e.offsetWidth || e.scrollHeight > e.offsetHeight ) .filter(e => { var style = window.getComputedStyle(e); return [style.overflow, style.overflowX, style.overflowY].some( e => e === "auto" || e === "scroll" ); }) .forEach(e => { var color = Math.floor(Math.random() * 16777215).toString(16); e.style.backgroundColor = "#" + color; throttle("scroll", "optimizedScroll", e); e.addEventListener("scroll", event => { console.log("%c[scroll]", "color: white; background-color:#" + color, event.target); }); }); }()
@tzmartin
tzmartin / m3u8-to-mp4.md
Last active April 26, 2024 01:50
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@Bjvanminnen
Bjvanminnen / instructions.md
Last active January 8, 2023 15:52
How to use glslify with create-react-app

Create your app

create-react-app my-app
cd my-app

Eject it, so that we can modify webpack config

npm run eject
y # when prompted
@oskarbraten
oskarbraten / custom_shader_example.js
Created November 21, 2017 18:48
A three.js custom shader example
"use strict";
class MyCustomMaterial extends THREE.ShaderMaterial {
// constructor takes appropriate parameters.
// Default values using object destructuring (ES6)
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Object_destructuring
constructor({
color = 0xffffff,
emissive = 0x000000,
@azu
azu / timer-logging.js
Last active June 1, 2021 07:16
Logging Timer and requestAnimationFrame
/**
* ## Usage
*
* 1. Load following script
* 2. `window.getContexualLogResult()` output the result to console
*
* ## Description
*
* - It spy "setTimeout", "setInterval", and "requestAnimationFrame".
* - Collect call count and collect stack trace.
@jayjariwala
jayjariwala / gist:c4e5b0442506e8cc38ea7f7b3024c42e
Last active June 15, 2018 14:59
Apostrophe in Production on Digital Ocean or any linux server
1) Create a droplet
You will recieve an email with root password information.
2) login using ssh though your local remote terminal (find your ipaddress on the digital ocean droplet control panel) or use ssh authentication
ssh root@ipaddress
password:write from email
change password upon first login
3) Once login as a root. update latest ubuntu packages
sudo apt-get install update
sudo apt-get install upgrade
4) Add a non-root user with root previlagies
@theecrit
theecrit / Content-UX-Slack-CoC.mdown
Last active September 6, 2019 18:43 — forked from mjmetts/Content-UX-Slack-CoC.mdown
A Code of Conduct for the Content+UX Slack Group

UPDATE as of 9/3/19

This version of the Code of Conduct is now out of date. Please see https://contentandux.org/code-of-conduct for the most up-to-date version.

Code of Conduct

Last updated: June 11, 2019

The Content + UX Slack Group is dedicated to providing a harassment-free experience for everyone. We do not tolerate harassment of participants in any form.

This code of conduct applies to every member of the Content + UX Slack Group. Anyone who violates this code of conduct may be sanctioned or expelled from the Content + UX Slack Group at the discretion of the ADMIN TEAM.

@didacus
didacus / property.js
Created February 7, 2019 08:53
Framer X — Property Controls
import * as React from 'react'
import { PropertyControls, ControlType } from 'framer'
// Define type of property
export interface Props {
text: string,
color: string,
boolean: boolean,
numberA: number,
numberB: number,