Skip to content

Instantly share code, notes, and snippets.

@namtransgvn
namtransgvn / macos-app-icon.md
Created December 15, 2025 23:39 — forked from ansarizafar/macos-app-icon.md
How to create an .icns macOS app icon
@namtransgvn
namtransgvn / downloadFile.dart
Created September 9, 2023 02:16 — forked from ajmaln/downloadFile.dart
Download file with progress in Dart/Flutter using 'http' package
import 'dart:typed_data';
import 'dart:io';
import 'package:http/http.dart';
import 'package:path_provider/path_provider.dart';
downloadFile(String url, {String filename}) async {
var httpClient = http.Client();
var request = new http.Request('GET', Uri.parse(url));
@namtransgvn
namtransgvn / IndexComponent.vue
Created May 23, 2022 23:06 — forked from ChinwalPrasad/IndexComponent.vue
Vuetify DataTable export PDF and multi-filters Example
<template>
<v-card class="p-64">
<v-card-title>Class Schedule
<v-spacer></v-spacer>
<v-btn @click="createPDF" color="primary">Download as PDF</v-btn>
<v-spacer></v-spacer>
<v-select :items="fillColleges" multiple clearable single-line hide-details label="Filter By College" @change="filterCollege"></v-select>
<v-spacer></v-spacer>
<v-select :items="fillPrograms" multiple clearable single-line hide-details label="Filter By Program" @change="filterProgram"></v-select>
<v-spacer></v-spacer>
@namtransgvn
namtransgvn / gist:82dd1391bdb90a9253bd1dd44470a479
Created July 23, 2021 00:25 — forked from v9n/gist:4323171
Check free space on IOS device
//@author http://stackoverflow.com/questions/5712527/how-to-detect-total-available-free-disk-space-on-the-iphone-ipad-device
- (uint64_t)freeDiskspace
{
uint64_t totalSpace = 0;
uint64_t totalFreeSpace = 0;
__autoreleasing NSError *error = nil;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error];
@namtransgvn
namtransgvn / gist:c2a77b5db8ba16d300033f7ba3215544
Created July 15, 2021 04:08 — forked from ccgus/gist:6324222
Custom SQLite Functions
[db makeFunctionNamed:@"UTTypeConformsTo" maximumArguments:2 withBlock:^(sqlite3_context *context, int argc, sqlite3_value **argv) {
if (sqlite3_value_type(argv[0]) == SQLITE_TEXT) {
const unsigned char *a = sqlite3_value_text(argv[0]);
const unsigned char *b = sqlite3_value_text(argv[1]);
CFStringRef as = CFStringCreateWithCString(nil, (const char*)a, kCFStringEncodingUTF8);
CFStringRef bs = CFStringCreateWithCString(nil, (const char*)b, kCFStringEncodingUTF8);
sqlite3_result_int(context, UTTypeConformsTo(as, bs));
@namtransgvn
namtransgvn / stardict2txt.py
Created June 9, 2021 09:32 — forked from rongyi/stardict2txt.py
convert a stardict dictionary to txt
#!/usr/bin/python
# -*- coding: utf-8 -*-
import struct
import types
import gzip
class IfoFileException(Exception):
"""Exception while parsing the .ifo file.
Now version error in .ifo file is the only case raising this exception.
@namtransgvn
namtransgvn / main.go
Created May 17, 2021 09:01 — forked from xyproto/main.go
gzip compression/decompression example
package main
import (
"fmt"
"compress/gzip"
"io"
"io/ioutil"
"bytes"
"log"
)