Skip to content

Instantly share code, notes, and snippets.

To embed the contents of an SVG file into your site using NextJS 12 with the new Rust-based compiler, perform the following steps:

  1. Install @svg/webpack:
$ npm install --save-dev @svgr/webpack
  1. Create a svgr.config.js config file with the following contents. This will remove the width and height from the SVG but keep the viewBox for correct scaling.
@parthdesai93
parthdesai93 / aws_es_connector.js
Last active April 8, 2021 06:18
http-aws-es compatible with new Elasticsearch client.
/* requires AWS creds to be updated.
* if they aren't, update using AWS.config.update() method before instatiing the client.
*
* import this module where you instantiate the client, and simply pass this module as the connection class.
*
* eg:
* const client = new Client({
* node,
* Connection: AwsConnector
* });
@thaerlabs
thaerlabs / AppSync_snippets.md
Last active March 9, 2020 07:08
Snippets and utils to be used with AWS AppSync VTL Templates

Remove empty values from object to prevent DynamoDB empty string exception

#set ($values = {})

#foreach ($entry in $ctx.args.input.entrySet())
  #if( !$util.isNullOrBlank($entry.value) )
  	$util.qr($values.put($entry.key, $entry.value))
  #end
#end
@dericed
dericed / sips-r.sh
Created September 10, 2015 16:45
recursive use of sips to create a directory of thumbnails from a directory of images
#!/bin/bash
if [[ ! "${#}" == 2 ]] ; then
echo "Please provide input and output directories, and no other arguments."
exit 1
fi
input="${1}"
output="${2}"
@jwalton512
jwalton512 / Api\Admin\TestCase.php
Created August 9, 2015 08:46
Api Testing With Laravel 5.1 (jwt-auth)
<?php
namespace Tests\Api;
use App\User;
use Tests\TestCase as BaseTestCase;
use Illuminate\Contracts\Auth\Authenticatable as UserContract;
class TestCase extends BaseTestCase
{
@kottenator
kottenator / simple-pagination.js
Created July 13, 2015 20:44
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
@joepie91
joepie91 / delay-promise.js
Last active July 29, 2022 20:02
ES6 Promise.delay
module.exports = function(duration) {
return function(){
return new Promise(function(resolve, reject){
setTimeout(function(){
resolve();
}, duration)
});
};
};
@kevinrenskers
kevinrenskers / progress-button.less
Last active January 20, 2017 11:11
Progress button for AngularJS
/* General styles for all types of buttons */
.progress-button {
position: relative;
display: inline-block;
}
.progress-button .progress-button-content {
position: relative;
display: block;
}
@k3karthic
k3karthic / truncate_dynamodb.sh
Last active July 12, 2022 18:56
Truncate all keys in a dynamodb table
#!/bin/bash
TABLE_NAME=$1
# Get id list
aws dynamodb scan --table-name $TABLE_NAME | grep ID | awk '{ print $2 }' > /tmp/truncate.list
# Delete from id list
cat /tmp/truncate.list | xargs -IID aws dynamodb delete-item --table-name $TABLE_NAME --key '{ "id": { "S": "ID" }}'
@evillemez
evillemez / gist:8024315
Created December 18, 2013 15:32
On deploying apps w/ Symfony and Angular.js

Project Deployment with Symfony2 & Angular.js

Symfony2 and Angular.js make a great, robust combintaion. Integrating them isn't immediately obvious, however. Both communities come with their own standards and suite of tools for managing the development process, and sometimes those tools conflict.

On the Symfony side, you mainly deal with composer for managing your dependencies, a few Symfony commands in your project, and any other tools you add into the mix, like phpunit.

On the Angular side, you'll probably end up using npm, bower and probably grunt for automating some of the pain.

The short answer