Skip to content

Instantly share code, notes, and snippets.

@mikeblas
mikeblas / SampleData.md
Last active March 12, 2024 14:23
FAQ: Where can I get sample data?

It's not so hard to find sample data and data sources to use for interesting side-projects, or just for practicing writing SQL.

In-product sample data

Most DBMSes come with sample databases. You can write lots of interesting queries against them, and usually a tutorial accompanies the database in the documentation.

@peterbsmyth
peterbsmyth / recipe.example.md
Last active May 21, 2020 13:39
Making chained API Calls using @ngrx/Effects

Making chained API Calls using @ngrx/Effects

Purpose

This recipe is useful for cooking up chained API calls as a result of a single action.

Description

In the below example, a single action called POST_REPO is dispatched and it's intention is to create a new repostiory on GitHub then update the README with new data after it is created.
For this to happen there are 4 API calls necessary to the GitHub API:

  1. POST a new repostiry
  2. GET the master branch of the new repository
  3. GET the files on the master branch
@Xaz16
Xaz16 / app.js
Last active November 13, 2019 15:57
Check useragent or platform of client navigator and apply it on body
var platform = {
ipad: /iPad/.test(navigator.userAgent) && !window.MSStream,
ios: /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream,
safari: navigator.userAgent.indexOf('Safari') !== -1 && navigator.userAgent.indexOf('Chrome') === -1 && !window.MSStream,
mac: navigator.platform.toLowerCase().indexOf('mac') >= 0 && !window.MSStream,
android: /(android)/i.test(navigator.userAgent) || navigator.platform.toLowerCase().indexOf("android") > -1 && !window.MSStream,
firefox: navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && !window.MSStream,
windows: navigator.platform.indexOf('Win') > -1 && !window.MSStream,
ie: !!window.MSInputMethodContext && !!document.documentMode && !window.MSStream
};
@askilondz
askilondz / gistlog.yml
Last active June 24, 2023 18:47
Adaptive Streaming with MPEG-DASH and HLS using AWS

Adaptive Streaming has become the neccessity for streaming video and audio. Unfortantely, as of this post, there isn't a whole lot of tutorials that accumulate all of the steps to get this working. Hopefully this post achieves that. This post focuses on using Amazon Web Services (AWS) to transcode for HLS and DASH and be the Content Delivery Network (CDN) that delivers the stream to your web page. We'll be using Video.js for the HTML5 player as well as javascript support libaries to make Video.js work with HLS and DASH.

So Here's what you need:

Set up three S3 buckets

@mikoim
mikoim / README.md
Last active January 27, 2024 22:32
[Updated! Aug 14 2020] YouTube recommended encoding settings on ffmpeg (+ libx264)

Parameters

Container: MP4

Parameter YouTube recommends setting
-movflags faststart moov atom at the front of the file (Fast Start)

Video codec: H.264

@x35a
x35a / scaleFontSize.js
Last active April 26, 2019 21:17
jq plugin decrease font size on text ovrfl
/*
works with JQ
usage
<p class="targetElement">Text to scale</p>
$('.targetElement').scaleFontSize({minFontsize: 12});
minFontsize минимальное размер шрифта для уменьшения, default 16px.
Определяется переполнение по ширине и высоте.
Определение переполнения по высоте работает если элементу задан height.
@bhavik07
bhavik07 / angular2-replace.ts
Last active October 26, 2018 19:30
Another approach that can be used to create components that can replace there host elements, based on my SO question(http://stackoverflow.com/questions/34280475/remove-the-host-html-element-selectors-created-by-angular-component). Consider checking this http://plnkr.co/edit/LFKN5doI9Y9wKwPxBbcJ?p=preview
/// <reference path="../node_modules/angular2/core.d.ts" />
/// <reference path="../node_modules/angular2/platform/browser.d.ts" />
/// <reference path="../node_modules/angular2/common.d.ts" />
import { Component, View, Directive, Input, ElementRef, Output, EventEmitter } from 'angular2/core';
import { bootstrap } from 'angular2/platform/browser';
//remove the host of avatar to be rendered as svg
@Directive({
@staltz
staltz / introrx.md
Last active March 26, 2024 00:52
The introduction to Reactive Programming you've been missing
$(document).ready(function() {
/* Hide all elements outside the visible window */
$('body *').each( function(){
var top_of_object = $(this).position().top;
var bottom_of_window = $(window).scrollTop() + $(window).height();
if( bottom_of_window < top_of_object ){