Skip to content

Instantly share code, notes, and snippets.

View techlab23's full-sized avatar
🚀
Right steps

Shirish Nigam techlab23

🚀
Right steps
  • Techlab23
  • Brisbane, Australia
  • 14:40 (UTC +10:00)
  • X @_shirish
View GitHub Profile
@techlab23
techlab23 / index.vue
Created May 15, 2020 09:49
Using storyblok api
<template>
<div class="grid grid-cols-1 md:grid-cols-3 gap-2">
<ProjectPreview
v-for="project in projects"
:key="project.id"
:title="project.title"
:excerpt="project.excerpt"
:feature-image="project.feature_image"
/>
</div>
@techlab23
techlab23 / jwtRS256.sh
Created October 4, 2019 16:59 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@techlab23
techlab23 / geoip.sh
Created August 28, 2019 00:46 — forked from kenjij/geoip.sh
Downloading free MaxMind GeoIP file, use with NGINX
# Download the legacy format for NGINX compatibility
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
# Unzip
gunzip Geo*.gz
# Copy to /usr/share/GeoIP/
cp Geo*.dat /usr/share/GeoIP/
@techlab23
techlab23 / gist:1f343661ac8a7ae67c7440ab4b0b0b5b
Created May 25, 2019 07:56
Bundle Optimisation - Using PurgeCSS with Vue.js
// Install purgecss as dev dependency
$ npm i -D purgecss @fullhuman/postcss-purgecss
// First make sure you don't have postcss related stuff in your package.json
// Create postcss.config.js file at the root of the project (if not already exist)
// Then put in the following code
const purgecss = require("@fullhuman/postcss-purgecss")
module.exports = {
plugins: [
@techlab23
techlab23 / Sample.vue
Last active October 16, 2020 05:24
Vue Component
<template>
<div>
<h1> {{ message }} </h1>
<div
</template>
<script>
export default {
/* Child component registration */
components: {},
@techlab23
techlab23 / secure-image-usage
Created December 12, 2018 16:18
Using the secure image directive
<div class="card m-2" v-for="pic in location.pictures">
<!-- <img class="m-2" style="height:120px;width:130px" :src="getThumbnailPath(pic)"> -->
<img class="m-2" style="height:120px;width:130px" v-secure-image="getThumbnailPath(pic)">
<div class="p-2 d-flex justify-content-center">
<button class="btn btn-sm btn-outline-danger align-self-center"
v-if="!complete"
@click="removeImage(pic)">
<i class="fa fa-times"></i> Delete
</button>
</div>
@techlab23
techlab23 / secure-image.vue
Created December 12, 2018 16:13
Vue directive to secure images
import Vue from 'vue'
function setImgSrc(el, binding) {
if (binding.oldValue === undefined || binding.value !== binding.oldValue) {
var imageUrl = binding.value;
// Enable the code below to use already base64 encoded image response data from server //
// axios.get(imageUrl).then(response => el.src = response.data)
// Receiving the file from server and base64 encodig the file
<?php
/**
* Set preffered countries for Caldera Forms phone fields
*/
add_filter( 'caldera_forms_phone_js_options', function( $options){
//Use ISO_3166-1_alpha-2 formatted country code
$options[ 'preferredCountries' ] = array( 'MX' );
return $options;
});
@techlab23
techlab23 / file-download.js
Created August 29, 2018 10:32
File download with vue
axios({
url: 'http://my-api.dev/file-download',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf'); //or any other extension
document.body.appendChild(link);
@techlab23
techlab23 / default.vue
Created July 25, 2018 12:45
Using mailchimp popup subscribe in Nuxt.js project (layouts/default.vue)
<template>
<b-container fluid>
<app-nav/>
<nuxt/>
</b-container>
</template>
<script>
export default {
mounted() {