Skip to content

Instantly share code, notes, and snippets.

Shilo Shilo

Block or report user

Report or block Shilo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Shilo
Shilo / ViewController.swift
Created Jul 31, 2017
Swift snippet for jumping to a specific PDF page in WKWebView.
View ViewController.swift
func webViewGotoPDFPage(index: Int) {
if (index < 1) { return; }
let pageCount = totalPDFPages(filePath: webViewLastURL!);
let pageIndex = max(min(index, pageCount), 1)-1;
/*
let firstPage = self.webView.scrollView.subviews[2].subviews[0];
//let contentHeight = self.webView.scrollView.contentSize.height;
//let totalPaddingSize = CGFloat(PDF_INNER_PADDING)*(CGFloat(pageCount)-1) + CGFloat(PDF_OUTER_PADDING)*2;
@Shilo
Shilo / eodata_spells.cpp
Last active Mar 8, 2017
EOServ log spells to errors.log, inside method "void ESF::Read(const std::string& filename)" at approximately line 311.
View eodata_spells.cpp
static bool logHeader = false;
if (!logHeader) {
Console::Err("ID,Name,Channel,\
Type,Target Restrict,Target,\
Cast Time,TP Cost,SP Cost,Heal,Min Dmg,Max Dmg,\
Accuracy");
logHeader = true;
}
if (newdata.name != "eof") {
Console::Err("%i,%s,%s,\
@Shilo
Shilo / eodata_classes.cpp
Last active Mar 8, 2017
EOServ log classes to errors.log, inside method "void ECF::Read(const std::string& filename)" at approximately line 397.
View eodata_classes.cpp
static bool logHeader = false;
if (!logHeader) {
Console::Err("ID,Name,Sub-Class,\
Stat Table,Base Str,Base Int,Base Wis,Base Agi,Base Con,Base Cha");
logHeader = true;
}
if (newdata.name != "eof") {
Console::Err("%i,%s,%i,\
%i,%i,%i,%i,%i,%i,%i",
newdata.id, newdata.name.c_str(), newdata.base,
@Shilo
Shilo / eodata_npcs.cpp
Created Mar 8, 2017
EOServ log NPCs to errors.log, inside method "void ENF::Read(const std::string& filename)" at approximately line 213.
View eodata_npcs.cpp
static bool logHeader = false;
if (!logHeader) {
Console::Err("ID,Name,Type,Child,Parent,\
HP,EXP,Min Dmg,Max Dmg,Acc,Eva,Def,Vendor ID");
logHeader = true;
}
if (newdata.name != "eof") {
Console::Err("%i,%s,%i,%i,%i,\
%i,%i,%i,%i,%i,%i,%i,%i",
newdata.id, newdata.name.c_str(), newdata.type, newdata.child, newdata.boss,
@Shilo
Shilo / eodata_items.cpp
Created Mar 8, 2017
EOServ log items to errors.log, inside method "void EIF::Read(const std::string& filename)" at approximately line 115.
View eodata_items.cpp
static bool logHeader = false;
if (!logHeader) {
Console::Err("ID,Name,Type,Sub-Type,Rarity,Weight,\
HP,TP,Min Dmg,Max Dmg,Acc,Eva,Def,\
Str,Int,Wis,Agi,Con,Cha,\
Req Class,Req Level,Req Str,Req Int,Req Wis,Req Agi,Req Con,Res Cha,\
Res Light,Res Dark,Res Earth,Res Air,Res Water,Res Fire");
logHeader = true;
}
Console::Err("%i,%s,%i,%i,%i,%i,\
@Shilo
Shilo / eodata_weapons.cpp
Created Mar 8, 2017
EOServ log weapon items to errors.log, inside method "void EIF::Read(const std::string& filename)" at approximately line 115.
View eodata_weapons.cpp
static bool logHeader = false;
if (!logHeader) {
Console::Err("ID,Name,Type,Rarity,Weight,\
HP,TP,Min Dmg,Max Dmg,Acc,Eva,Def,\
Str,Int,Wis,Agi,Con,Cha,\
Req Class,Req Level,Req Str,Req Int,Req Wis,Req Agi,Req Con,Res Cha,\
Res Light,Res Dark,Res Earth,Res Air,Res Water,Res Fire");
logHeader = true;
}
if (newdata.type == EIF::Type::Weapon) {
@Shilo
Shilo / eodata_monsters.cpp
Last active Mar 8, 2017
EOServ log passive/aggressive NPCs to errors.log, inside method "void ENF::Read(const std::string& filename)" at approximately line 213.
View eodata_monsters.cpp
static bool logHeader = false;
if (!logHeader) {
Console::Err("ID,Name,EXP,HP,Avg Dmg,Total Stats");
logHeader = true;
}
if (newdata.type == ENF::Type::Passive || newdata.type == ENF::Type::Aggressive) {
unsigned int NPCAdjustMaxDam = 3;
Console::Err("%i,%s,%i,%i,%i,%i",
newdata.id, newdata.name.c_str(), newdata.exp, newdata.hp,
static_cast<int>(std::round((newdata.mindam+newdata.maxdam+NPCAdjustMaxDam)/2)),
@Shilo
Shilo / file-size.pipe.ts
Created Nov 2, 2016 — forked from JonCatmull/file-size.pipe.ts
Angular2 + TypeScript file size Pipe/Filter. Convert bytes into largest possible unit. e.g. 1024 => 1 KB
View file-size.pipe.ts
import { Pipe, PipeTransform } from '@angular/core';
/*
* Convert bytes into largest possible unit.
* Takes an precision argument that defaults to 2.
* Usage:
* bytes | fileSize:precision
* Example:
* {{ 1024 | fileSize}}
* formats to: 1 KB
@Shilo
Shilo / svn_ignore.sh
Created Sep 6, 2016
Terminal command to add svn ignores via ".gitignore" file.
View svn_ignore.sh
svn propset svn:ignore -RF .gitignore .
@Shilo
Shilo / gist:76f8428d010916b50a4461418cba33cb
Created Aug 6, 2016 — forked from qiaoxueshi/gist:5918651
Disable warning "PerformSelector may cause a leak because its selector is unknown"
View gist:76f8428d010916b50a4461418cba33cb
//disable warning:"PerformSelector may cause a leak because its selector is unknown"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
[self.delegate performSelector:self.selector];
#pragma clang diagnostic pop
You can’t perform that action at this time.