Skip to content

Instantly share code, notes, and snippets.

View ClydeDz's full-sized avatar
🌐
Visit my website for more info!

Clyde D'Souza ClydeDz

🌐
Visit my website for more info!
View GitHub Profile
@ClydeDz
ClydeDz / CoffeeChoicesService.js
Created April 12, 2020 07:46
Service to Fauna - Stack Overflow question
async updateChoice(choiceID, coffeeType) {
var latestChoices = null;
await getAllChoices.then(res => {
console.log("updateChoiceService getlatest", res[0].data);
latestChoices = res[0].data;
});
console.log("updateChoiceService", choiceID, coffeeType, latestChoices);
await updateChoices(choiceID, latestChoices).then(res => {
console.log("create ok");
@ClydeDz
ClydeDz / component.js
Created April 12, 2020 07:49
Component that uses the service - Stack Overflow question
var [coffeeChoices, setCoffeeChoices] = React.useState([]);
React.useEffect(() => {
async function fetchData() {
var _service = new CoffeeChoicesService();
var x = await _service.getChoices();
console.log(x[0].data);
setCoffeeChoices(x[0].data);
}
fetchData();
@ClydeDz
ClydeDz / gulpfile.js
Created April 18, 2020 01:14
gulp-sass demo - Medium article
var gulp = require('gulp');
var sass = require('gulp-sass');
gulp.task('compile-sass', function() {
return gulp.src('./src/sass/*.scss')
.pipe(sass({outputStyle: 'compressed'}))
.pipe(gulp.dest('./src/css'));
});
@ClydeDz
ClydeDz / index.html
Last active April 18, 2020 01:22
gulp-inject demo - Medium article
<head>
<title>Hello</title>
<!-- inject:css -->
<!-- endinject -->
</head>
@ClydeDz
ClydeDz / gulpfile.js
Last active April 19, 2020 01:48
gulp-inject demo - Medium article
var gulp = require('gulp');
var inject = require('gulp-inject');
gulp.task('add-styles', function () {
var target = gulp.src('./src/index.html');
var sources = gulp.src(['./src/css/*.css'], {});
return target.pipe(inject(sources))
.pipe(gulp.dest('./dist'));
});
@ClydeDz
ClydeDz / index.html
Last active April 19, 2020 01:50
Modified file - gulp-inject - Medium article
<head>
<title>Hello</title>
<!-- inject:css -->
<link rel="stylesheet" href="/src/css/main.css">
<!-- endinject -->
</head>
@ClydeDz
ClydeDz / gulpfile.js
Last active April 19, 2020 01:47
gulp-replace demo - Medium article
var gulp = require('gulp');
var replace = require('gulp-replace');
var fs = require('fs');
function getCSSFilename(linkTag) {
var hrefValue = /href\=\"([A-Za-z0-9/._]*)\"/g;
var cssFilename = linkTag.match(hrefValue);
cssFilename = cssFilename[0].replace("href=\"", "").replace("\"", "");
return cssFilename;
}
@ClydeDz
ClydeDz / index.html
Last active April 19, 2020 01:51
Final HTML file - Medium article
<!DOCTYPE html>
<html>
<head>
<title>Hello</title>
<!-- inject:css -->
<style>
body{color:blue}
</style>
<!-- endinject -->
</head>
@ClydeDz
ClydeDz / automapper-demo.cs
Created July 9, 2020 11:42
Automapper demo to map simple source object into nested destination object.
using System;
using AutoMapper; // Install via NuGet
namespace AutomapperNested
{
// Automapper demo to map simple source object into nested destination object.
class Program
{
public static void Main(string[] args)