Skip to content

Instantly share code, notes, and snippets.

View nishabe's full-sized avatar

nish abe nishabe

View GitHub Profile
@nishabe
nishabe / gist:0f3a60cd73bc2c7fcf9144d0442f674b
Last active July 1, 2019 15:50
Capitalize first letter of every word in a string (Swift)
extension String {
func capitalizingFirstLetter() -> String {
return prefix(1).capitalized + dropFirst()
}
func getCamelCasedString () -> String {
var camelCasedStringCollection = [String]()
let stringComponents = components(separatedBy: " ")
for var oneComponent in stringComponents {
oneComponent = oneComponent.capitalizingFirstLetter()
camelCasedStringCollection.append(oneComponent)
@nishabe
nishabe / Serialize an Object to JSON.swift
Created July 3, 2019 20:27
Serialize an Object to JSON in swift
do {
let jsonData = try JSONEncoder().encode(myObjectHere)
let json = String(data: jsonData, encoding: .utf8)
print(json!)
}
catch {
print(error)
}
@nishabe
nishabe / sonar-project.properties
Last active August 3, 2022 19:00
sonar-project.properties
#
# Swift SonarQube Plugin - Enables analysis of Swift and Objective-C projects into SonarQube.
# Copyright © 2015 Backelite (${email})
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@nishabe
nishabe / Fastfile
Last active July 16, 2019 18:50
Fastfile
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
default_platform(:ios)
platform :ios do
desc "Description of what the lane does"
lane :metrics do
scan(scheme: "testSonar",
// GIF creation
ffmpeg -ss 00:00:03.000 -i SpendTogether.mp4 -pix_fmt rgb24 -r 10 -s 440x960 -t 00:00:8.000 SpendTogether4.gif
ffmpeg -ss 00:00:10.000 -i Expressions.mp4 -pix_fmt rgb24 -r 10 -s 524x1080 -t 00:00:12.000 Expressions1.gif
// For optimization
convert -layers Optimize SpendTogether2.gif output_optimized.gif
// Installation of Tools
brew install ffmpeg
brew install imagemagick
@nishabe
nishabe / fonts.swift
Created June 2, 2020 20:18
Print All Font Families available in the Application
for family: String in UIFont.familyNames
{
print(family)
for names: String in UIFont.fontNames(forFamilyName: family)
{
print("== \(names)")
}
}
// lambda.ts
import { Handler, Context } from 'aws-lambda';
import { Server } from 'http';
import { createServer, proxy } from 'aws-serverless-express';
import { eventContext } from 'aws-serverless-express/middleware';
import { NestFactory } from '@nestjs/core';
import { ExpressAdapter } from '@nestjs/platform-express';
import { AppModule } from './app.module';
@nishabe
nishabe / serverless.yaml
Created November 19, 2020 05:14
serverless.yaml
service:
name: nest-serverless-lambda-demo
plugins:
- 'serverless-plugin-typescript'
- serverless-plugin-optimize
- serverless-offline
provider:
name: aws
@nishabe
nishabe / app.controller.ts
Last active January 7, 2021 15:10
app.controller.ts
import { Controller, Get, HttpException, Query } from '@nestjs/common';
import { AppService } from './app.service';
import { StudentService } from './student/student.service';
@Controller('student')
export class AppController {
constructor(
private readonly appService: AppService,
private readonly studentService: StudentService,
) {}
@nishabe
nishabe / student.service.ts
Last active January 7, 2021 15:09
student.service.ts
import { HttpException, Injectable } from '@nestjs/common';
import { ApiService } from '../api/api.service';
export interface Student {
name: string;
grades: number[];
}
@Injectable()
export class StudentService {