Skip to content

Instantly share code, notes, and snippets.

View puttputt's full-sized avatar

kyle smyth puttputt

View GitHub Profile
@puttputt
puttputt / BasicAttributeSet.cpp
Created January 29, 2021 02:53
UE4 Gameplay Ability System Basic Implementation
#include "BasicAttributeSet.h"
#include "GameplayEffect.h"
#include "GameplayEffectExtension.h"
void UBasicAttributeSet::PostGameplayEffectExecute(const struct FGameplayEffectModCallbackData& Data)
{
Super::PostGameplayEffectExecute(Data);
//Clamping Health based on Max Health.
@puttputt
puttputt / prettier-autoformat-git-history
Last active January 14, 2020 17:28
Prettier Autoformat Git History
## From Marcus Motill https://medium.com/millennial-falcon-technology/reformatting-your-code-base-using-prettier-or-eslint-without-destroying-git-history-35052f3d853e
git filter-branch --tree-filter '\
prettier --no-config --single-quote --tab-width=4\
--print-width=128 --arrow-parens=always --trailing-comma=all\
--write "**/**.ts" "**/**.html" || \
echo “Error formatting, possibly invalid JS“' -- --all
@puttputt
puttputt / moment.duration.humanizeLong.ts
Created November 26, 2019 23:45
Extending moment.Duration to have a long format humanized string
import * as moment from 'moment';
declare module 'moment' {
interface Duration {
humanizeLong(): string;
}
}
(moment.duration as any).fn.humanizeLong = function (): string {
@puttputt
puttputt / diamond.js
Last active April 24, 2019 23:32
tedx presentation: diamond shape problem
// usage:
// node diamond.js 8
//
const length = parseInt(process.argv.slice(2)[0]);
const char = '*';
const space = ' ';
const newLine = '\n';
const TWO = 2;
var charCount = 1;
@puttputt
puttputt / StringTreeSearch.ts
Created October 12, 2017 21:36
String Tree Search
export class TreeNode {
label : any;
data : any;
nodes : TreeNode[];
constructor(label : any) {
this.label = label;
this.nodes = [];
}
public async deleteCompany(req: Request, res: Response, next: NextFunction) {
try {
let test = await this.service.delete(req.body.id);
res.status(200).json({});
} catch(error) {
res.status(400).json(error);
}
}
public async delete(id : number) : Promise<any> {
@puttputt
puttputt / CustomUIStepper.h
Created December 11, 2015 22:05
Custom UIStepper for iOS
//
// iQStepper.h
// iqStepper
//
// Created by Kyle Smyth on 2015-12-11.
//
#import <UIKit/UIKit.h>
IB_DESIGNABLE
@puttputt
puttputt / http-req.swift
Created September 11, 2014 23:18
http get request swift
var googleUrl = NSURL(string: "http://google.ca")
var request = NSMutableURLRequest(URL: googleUrl)
request.HTTPMethod = "GET"
request.addValue("text/html", forHTTPHeaderField: "Content-Type")
var session = NSURLSession.sharedSession()
let task = session.dataTaskWithRequest(request, completionHandler: {data, response, error -> Void in
if((error) != nil) {
@puttputt
puttputt / colourblind-friendly-kyle-smyth.icls
Created August 5, 2014 21:22
Colourblind Friendly Android Studio Theme
<?xml version="1.0" encoding="UTF-8"?>
<scheme name="kyle-custom" version="124" parent_scheme="Default">
<option name="LINE_SPACING" value="1.0" />
<option name="EDITOR_FONT_SIZE" value="14" />
<option name="EDITOR_FONT_NAME" value="Consolas" />
<colors>
<option name="CARET_ROW_COLOR" value="d8d8d8" />
<option name="GUTTER_BACKGROUND" value="ffffff" />
<option name="INDENT_GUIDE" value="d8d8d8" />
<option name="LINE_NUMBERS_COLOR" value="d8d8d8" />
@puttputt
puttputt / ColourBlindCoder.icls
Created July 8, 2014 15:44
The theme I use in AndroidStudio with colours that don't appear the same as others, to me.
<?xml version="1.0" encoding="UTF-8"?>
<scheme name="ColourBlindCoder" version="124" parent_scheme="Default">
<option name="LINE_SPACING" value="1.0" />
<option name="EDITOR_FONT_SIZE" value="14" />
<option name="EDITOR_FONT_NAME" value="Consolas" />
<colors>
<option name="CARET_ROW_COLOR" value="d8d8d8" />
<option name="GUTTER_BACKGROUND" value="ffffff" />
<option name="INDENT_GUIDE" value="d8d8d8" />
<option name="LINE_NUMBERS_COLOR" value="d8d8d8" />