Skip to content

Instantly share code, notes, and snippets.

View sushant-j's full-sized avatar

Sushant J sushant-j

  • Copenhagen, Denmark
View GitHub Profile
@pinge
pinge / mobile.video.encoding.md
Last active March 19, 2024 20:06
Video and audio encoding for playback in Android and iOS devices

Video and audio encoding for playback in Android and iOS devices

This document aims to provide an easy way encode video optimized for playback in mobile devices that use the Android or the iOS operating systems.

libx264 is used for (single or two-pass) video encoding and libfdk_aac for audio encoding.

ffmpeg, libx264 and libfdk_aac settings are optimized for playback quality and compatibility on Android and iOS. There is extensive documentation and references for each of the settings used and contributions are very welcome :)

@sushant-j
sushant-j / html-guidelines.md
Last active February 13, 2017 12:30
Coding standards and guidelines for HTML files.

HTML Code Standards

1. HTML Attribute Ordering

HTML element attributes _must_ appear in following order:

HTML Native

  1. class
  • id, name
@simonw
simonw / remove-message.js
Last active March 6, 2023 08:40
JavaScript one-liner for removing a ?message=... parameter from the visible URL in the browser
history.replaceState && history.replaceState(
null, '', location.pathname + location.search.replace(/[\?&]message=[^&]+/, '').replace(/^&/, '?')
);
@paulirish
paulirish / what-forces-layout.md
Last active March 29, 2024 09:45
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@giuseppeg
giuseppeg / fuzzbuzz.js
Last active July 6, 2022 08:55
FizzBuzz solution with just one comparison:Bitwise operations, using predefined 0-15 numbers masksource: http://www.zoharbabin.com/which-fizzbuzz-solution-is-the-most-efficient
// FizzBuzz solution with one comparison:
// Bitwise operations, using predefined 0-15 numbers mask
// live demo: http://jsfiddle.net/TbAuQ/
// source: http://www.zoharbabin.com/which-fizzbuzz-solution-is-the-most-efficient
var words = [undefined, "Fizz", "Buzz", "FizzBuzz"],
mask = 810092048, //11 00 00 01 00 10 01 00 00 01 10 00 01 00 00
c = 0;
@dideler
dideler / 0-startup-overview.md
Last active March 28, 2024 02:16
Startup Engineering notes
@akshay1188
akshay1188 / whatsapp-image-compression
Last active June 10, 2023 16:42
Whatsapp like image compression
- (UIImage *)compressImage:(UIImage *)image{
float actualHeight = image.size.height;
float actualWidth = image.size.width;
float maxHeight = 600.0;
float maxWidth = 800.0;
float imgRatio = actualWidth/actualHeight;
float maxRatio = maxWidth/maxHeight;
float compressionQuality = 0.5;//50 percent compression
if (actualHeight > maxHeight || actualWidth > maxWidth) {
@rochacbruno
rochacbruno / haversine.py
Created June 6, 2012 17:43
Calculate distance between latitude longitude pairs with Python
#!/usr/bin/env python
# Haversine formula example in Python
# Author: Wayne Dyck
import math
def distance(origin, destination):
lat1, lon1 = origin
lat2, lon2 = destination