Skip to content

Instantly share code, notes, and snippets.

@k06a
k06a / MLWAsyncAVPlayer.h
Last active September 7, 2023 11:51
Awesome optimized AVPlayer for smooth scrolling AVPlayerLayer inside UICollectionView/UITableView (tested on iOS10+)
#import <AVFoundation/AVFoundation.h>
@interface MLWAsyncAVPlayer : AVPlayer
@end
@tzmartin
tzmartin / m3u8-to-mp4.md
Last active July 27, 2025 05:36
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
@mirsaeedi
mirsaeedi / AspnetWebApiUploadFile.cs
Created October 6, 2016 08:37
Helps you to save uploaded files to disk in ASP.Net Web API. The SaveFile method works with Request object directly.
public async Task<IHttpActionResult> SaveFile(string diskFolderPath)
{
var path = Path.GetTempPath();
if (!Request.Content.IsMimeMultipartContent("form-data"))
{
throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.UnsupportedMediaType));
}
MultipartFormDataStreamProvider streamProvider = new MultipartFormDataStreamProvider(path);
@teocci
teocci / ViewDataVS.md
Last active June 10, 2021 19:10
In ASP.NET MVC there are three ways - ViewData, ViewBag and TempData to pass data from controller to view and in next request.

ViewData vs ViewBag vs TempData vs Session

In ASP.NET MVC there are three ways - ViewData, ViewBag and TempData to pass data from controller to view and in next request. Like WebForm, you can also use Session to persist data during a user session. Now question is that when to use ViewData, VieBag, TempData and Session. Each of them has its own importance. In this article, I am trying to explain the differences among these four.

ViewData

ViewData is a dictionary object that is derived from ViewDataDictionary class.

public ViewDataDictionary ViewData { get; set; }

ViewData is a property of ControllerBase class. ViewData is used to pass data from controller to corresponding view. It’s life lies only during the current request.

<?xml version="1.0" encoding="us-ascii"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vs="http://schemas.microsoft.com/Visual-Studio-Intellisense" elementFormDefault="qualified" attributeFormDefault="unqualified" vs:helpNamespace="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<xs:element name="configuration">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:any namespace="##any" processContents="lax" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="location">
@homam
homam / Utils.cs
Last active August 20, 2019 16:11
My Big 2010s C# Utils
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Net.Mail;
using System.Web;
using System.Xml.Serialization;
@crmckenzie
crmckenzie / ControllerContextTestExtensions.cs
Last active August 20, 2019 16:13
Faking Controller Context
public static class Fakes
{
public static UrlHelper FakeUrlHelper(HttpContextBase httpContext, RouteData routeData, RouteCollection routeCollection)
{
var requestContext = new RequestContext(httpContext, routeData);
var urlHelper = new UrlHelper(requestContext, routeCollection);
return urlHelper;
}
public static RouteCollection GetRouteCollection()
@rahul286
rahul286 / mac-osx-el-captain-commands.sh
Last active September 24, 2024 03:11
Updating to Mac elCapitan using downloaded pkg file
## based on https://github.com/lioonline/OS-X-El-Capitan
## pkg file link - http://osxapps.itunes.apple.com/apple-assets-us-std-000001/Purple3/v4/74/d2/82/74d28291-9db9-7ae2-305d-9b8b3f5fd463/ftk3252456602304584541.pkg
# Run this from folder where you have downloaded or copied ftk3252456602304584541.pkg file
#create a tmp folder
mkdir elCapitanRoot && cd elCapitanRoot
#create a folder structure to match apple server
sudo mkdir -p ./apple-assets-us-std-000001/Purple3/v4/74/d2/82/74d28291-9db9-7ae2-305d-9b8b3f5fd463/
@pocheptsov
pocheptsov / SoapExtensionRegistration.cs
Created July 30, 2015 20:22
Register SoapExtension in a code
public static void RegisterSoapExtension(Type type, int priority, PriorityGroup group)
{
if (!type.IsSubclassOf(typeof(SoapExtension)))
{
throw new ArgumentException("Type must be derived from SoapException.", nameof(type));
}
if (priority < 1)
{
throw new ArgumentOutOfRangeException(nameof(priority), priority, "Priority must be greater or equal to 1.");