Skip to content

Instantly share code, notes, and snippets.

View arif-pandu's full-sized avatar
🏠
Working from home

Mapandu arif-pandu

🏠
Working from home
  • Cilacap, Central Java, Indonesia
  • X @mapen_
View GitHub Profile
@space-pope
space-pope / yt-dlp_partial_download.py
Last active February 9, 2025 18:31
Using yt-dlp to download a portion of a video in Python
"""
It took me far longer than necessary to figure out how to use yt-dlp to trim/download a subset of a longer video
outside the context of a command line (i.e., directly in Python), so I'm recording it here for posterity.
There's no shortage of command-line examples of using `--ppa "ffmpeg_i:[...]`, but the documentation doesn't
exactly make it clear how to translate this to the Python version of the options, so here goes. A couple
additional quirks come into play too; we'll get to those soon enough.
"""
import yt_dlp
@VictorHHT
VictorHHT / VTRangeStep.cs
Last active March 16, 2025 15:40
Unity Range Step Slider Property Attribute, allow the user to increase a float value or int value by step, like 0.25f or 3 or 100.15f
using System;
using UnityEditor;
using UnityEngine;
// Use Example 1: [VTRangeStep(0f, 10f, 0.25f)]
// Use Example 2: [VTRangeStep(100, 1000, 25)]
namespace Victor.Tools
{
[AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public sealed class VTRangeStep : PropertyAttribute
@tranductam2802
tranductam2802 / main.dart
Last active August 5, 2021 18:22
A TabBar supported for bubble view style and wheel scroll
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
void main() async =>
runApp(MaterialApp(debugShowCheckedModeBanner: false, home: DemoScreen()));
class DemoScreen extends StatefulWidget {
@override
_DemoScreenState createState() => _DemoScreenState();
}
@slightfoot
slightfoot / page_turn.dart
Created September 9, 2019 21:28
Page Turn Effect - By Simon Lightfoot. Replicating this behaviour. https://www.youtube.com/watch?v=JqvtZwIJMLo
// MIT License
//
// Copyright (c) 2019 Simon Lightfoot
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@muddassirm
muddassirm / LoadJson3.dart
Created August 24, 2018 18:30
Display JSON data in Flutter : Using a FutureBuilder
import 'package:flutter/material.dart';
import 'dart:convert';
import 'dart:async' show Future;
import 'package:flutter/services.dart' show rootBundle;
class Student {
String studentId;
String studentName;
int studentScores;
@sebtoun
sebtoun / JsonSerialisableScriptableObject.cs
Last active February 27, 2024 17:25
Unity's ScriptableObjects that easily serialize to JSON
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using UnityEngine;
public class JsonSerialisableScriptableObject<T> : ScriptableObject where T : JsonSerialisableScriptableObject<T>
{
@yasirkula
yasirkula / CircleGraphic.cs
Last active March 2, 2025 21:47
Create circles/ellipses in Unity UI system in one of three modes: FillInside, FillOutside and Edge.
using UnityEngine;
using UnityEngine.UI;
#if UNITY_EDITOR
using UnityEditor;
// Custom Editor to order the variables in the Inspector similar to Image component
[CustomEditor( typeof( CircleGraphic ) ), CanEditMultipleObjects]
public class CircleGraphicEditor : Editor
{
@GibsS
GibsS / RoundedRectGraphic.cs
Last active October 9, 2023 21:13
A Unity Canvas UI Graphic for a rectangle with rounded edges
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
[ExecuteInEditMode]
public class RoundRectGraphic : Graphic {
[Range(0, 200)]
public int radius;
public bool hasTop;
@IJEMIN
IJEMIN / PlayCloudDataManager.cs
Last active November 7, 2023 12:08
Unity Google Cloud Saved Game Data Manager Script
// code reference: http://answers.unity3d.com/questions/894995/how-to-saveload-with-google-play-services.html
// you need to import https://github.com/playgameservices/play-games-plugin-for-unity
using UnityEngine;
using System;
using System.Collections;
//gpg
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using GooglePlayGames.BasicApi.SavedGame;
//for encoding
@nnm-t
nnm-t / ConvertToSprite.cs
Last active February 2, 2025 16:28
Convert Texture2D To Sprite
using UnityEngine;
public static class ConvertToSpriteExtensiton
{
public static Sprite ConvertToSprite(this Texture2D texture)
{
return Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), Vector2.zero);
}
}