Skip to content

Instantly share code, notes, and snippets.

View vc7's full-sized avatar
🇹🇼
ミルクティー大好き

Lihsuan Chen vc7

🇹🇼
ミルクティー大好き
View GitHub Profile
@vc7
vc7 / osx.sh
Last active May 31, 2020 07:34
# TODO
@CrystDragon
CrystDragon / MyTextLabel.swift
Created May 17, 2018 08:19
Most basic custom UITextInput conformance, without selection interaction, no UI elements but only pure texts.
import UIKit
class MyTextLabel: UIView {
var textLayer = CATextLayer()
var textStorage: String = "" {
didSet {
textLayer.string = textStorage
}
}
@mono0926
mono0926 / Alert.swift
Last active September 20, 2018 14:21
Protocol OrientedなRxSwift化したUIAlertController
import Foundation
import RxSwift
private func getAllEnumValues<T: Hashable>(_: T.Type) -> [T] {
var i = 0
let iterator = AnyIterator<T> {
let next = withUnsafeBytes(of: &i) { $0.load(as: T.self) }
if next.hashValue != i { return nil }
i += 1
return next
@DingWeizhe
DingWeizhe / 寶寶.js
Last active March 8, 2017 14:05
新增line的功能
var fs = require('fs'),
http = require('http'),
https = require('https'),
express = require('express'),
bodyParser = require('body-parser'),
request = require('request'),
crypto = require('crypto'),
FBToken = '',
port = 443,
options = {
@gwengrid
gwengrid / TypeErasure.swift
Last active September 12, 2018 05:14
Example of type erasure with Pokemon
class Thunder { }
class Fire { }
protocol Pokemon {
typealias PokemonType
func attack(move:PokemonType)
}
struct Pikachu: Pokemon {
typealias PokemonType = Thunder
@iangreenleaf
iangreenleaf / gist:b206d09c587e8fc6399e
Last active June 18, 2025 17:13
Rails naming conventions

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@implementation NSNull (SafeNull)
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
NSMethodSignature *signature = [super methodSignatureForSelector:aSelector];
if (!signature) {
NSLog(@"Warning: Unsuported selector \"%@\" sent to NSNull object.", NSStringFromSelector(aSelector));
return [NSMethodSignature signatureWithObjCTypes:@encode(void)];
}
return signature;

FR24 to gpx

  1. Go to Flightradar24 flights database and find your flight
  2. Get URL like this: http://www.flightradar24.com/data/flights/UA853/#38ae207
  3. ./fr24togpx.rb 38ae207 > FILENAME.gpx
  4. Check you output file using GPS Visualizer
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
use Carp;
use IO::File;
use JSON;
use WWW::Mechanize;
@kobaatsu
kobaatsu / pref.csv
Last active August 5, 2022 07:22
都道府県一覧 #utils
北海道 HOKKAIDO hokkaido
青森県 AOMORI aomori
岩手県 IWATE iwate
宮城県 MIYAGI miyagi
秋田県 AKITA akita
山形県 YAMAGATA yamagata
福島県 FUKUSHIMA fukushima
茨城県 IBARAKI ibaraki
栃木県 TOCHIGI tochigi
群馬県 GUNMA gunma