Skip to content

Instantly share code, notes, and snippets.

View ChadRoberts21's full-sized avatar
⌨️
Always be coding

Chad ChadRoberts21

⌨️
Always be coding
  • Zupa Tech
  • Waterlooville
View GitHub Profile
@ChadRoberts21
ChadRoberts21 / SmallCogsLoading.html
Created April 6, 2018 09:41
Primayer Repaires Small Loading (cogs)
<div class="row">
<div class="col-sm-12">
<i class="fas fa-cog fa-spin fa-2x"></i>
<span> Loading ...</span>
<i class="fas fa-cog fa-spin fa-2x"></i>
</div>
</div>
@media (max-width: 768px){
.navbar-fixed-side{
margin-left:-15px;
margin-right:-15px
}
}
@media (min-width: 768px){
.navbar-fixed-side{
position:fixed;
margin:0 -15px;
@ChadRoberts21
ChadRoberts21 / ErrorModal.html
Created April 6, 2018 09:45
Primayer Repairs Error Modal
<div class="modal-mask">
<div class="modal-wrapper">
<div class="modal-container">
<div class="container-fluid">
<div class="row">
<div class="col-sm-3">
</div>
<div class="col-sm-6">
<i class="fas fa-exclamation-triangle fa-5x" style="color: #d33a1f"></i>
</div>
@ChadRoberts21
ChadRoberts21 / QueryMultipleAbstract.cs
Last active April 19, 2018 11:01
Api - QueryMultiple - abstract
public interface IQueryMultiple
{
bool Descending { get; }
bool HasQuery { get; }
bool HasSearch { get; }
string OrderBy { get; set; }
int Page { get; set; }
int PageCount { get; set; }
string Search { get; set; }
}
@ChadRoberts21
ChadRoberts21 / CustomFileStreamContent.cs
Created April 6, 2018 09:57
Utils - File Stream - Custom File Stream
public class CustomFileStreamContent : StreamContent
{
string filePath;
public CustomFileStreamContent(Stream fileStream, string filePath) : base(content: fileStream)
{
this.filePath = filePath;
}
private CustomFileStreamContent(Stream fileStream) : base(content: fileStream)
@ChadRoberts21
ChadRoberts21 / OnlyDateConverter.cs
Created April 6, 2018 09:59
Util - DateTime - Only Date Converter
public class OnlyDateConverter: IsoDateTimeConverter
{
public OnlyDateConverter()
{
DateTimeFormat = "dd-MM-yyyy";
}
}
@ChadRoberts21
ChadRoberts21 / simple.vue
Created April 10, 2018 15:08
Vue file boilerplate
<template>
<div >
<!-- content -->
</div>
</template>
<script>
export default {
name: 'NAME_OF_COMOPONENT',
data () {
@ChadRoberts21
ChadRoberts21 / Search24hWideTimeSpanLinq.cs
Created April 19, 2018 10:57
Get Last 24h of data (LINQ)
// query= a Query object containing a search string
DateTime searchTime;
if (DateTime.TryParse(query.Search, out searchTime))
{
DateTime endTime = searchTime + new TimeSpan(24, 0, 0);
IQueryable linq = dbContext.DataTable
.Where(x => x.TimeStamp >= searchTime)
.Where(x => x.TimeStamp <= endTime);
@ChadRoberts21
ChadRoberts21 / GenericRESTfulUpdate.cs
Created April 25, 2018 14:16
A generic RESTful update method using reflection
public static bool Update<T>(long id, T updatedObj)
{
using (DBContext db = new DbContext())
{
var originalObj = db.T.Where(x => x.id == id).FirstOrDefault();
var rawObj = new T();
if (originalObj != null)
{
foreach (PropertyInfo propertyInfo in updatedObj.GetType().GetProperties())
{
@ChadRoberts21
ChadRoberts21 / CMDUtils.cs
Last active July 26, 2018 09:40
CMD Utils
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace <Project>.CMD
{
public static class Utils