Skip to content

Instantly share code, notes, and snippets.

View joadr's full-sized avatar
🏠
Working from home

Joaquin Diaz joadr

🏠
Working from home
View GitHub Profile
@joadr
joadr / README.md
Last active June 29, 2024 09:00
Mikro-orm v5 to v6 migration script

Mikro-orm v5 to v6 migration script

We ran npm install and updated some dependencies, and found out that our nestjs projects that used v5 mikro-orm development project stopped working. We started getting depedency injection errors and looking around in the github issues some other people where having the same problems. The proposed solution in one of them was updating from v6 to v6.0.1

As we had not updated iu. It seems a dependency of @mikro-orm/nestjs package received a breaking change update with minor version bump. Resulting in breaking compatibility with v5 mikro-orm.

@joadr
joadr / main.js
Last active November 19, 2020 02:42
insomnia-plugin-pathname
/**
* For an url like this: https://api.somewebsite.com/v1/some_path
* this will return /v1/some_path
*/
module.exports.templateTags = [{
name: 'pathname',
displayName: 'pathname',
description: 'pathname',
async run (context) {
@joadr
joadr / restartSound.sh
Created June 27, 2017 20:22
restart sound
sudo alsa force-reload
@joadr
joadr / restartBluetooth.sh
Created June 27, 2017 20:21
restart bluetooth ubuntu
sudo /etc/init.d/bluetooth restart
@joadr
joadr / deploy.sh
Last active April 12, 2017 18:46
Local Meteor Build for Orion Hostin
#!/bin/bash
set -e
echo ""
echo "====> Creating app bundle..."
echo ""
TMPFOLDER=$(mktemp -d)
meteor build --architecture=os.linux.x86_64 $TMPFOLDER --server-only --allow-superuser
echo ""
echo "====> Pushing Bundle"
echo ""
@joadr
joadr / rcomponent.sublime-snippet
Created October 19, 2016 19:01
ReactComponent Snippet based on filename
<snippet>
<content><![CDATA[
import React from 'react'
const propTypes = {
}
export default class ${1:${TM_FILENAME/^(\w)|(?:-(\w))|(?:.jsx)/(?1\u$1:)(?2\u$2:)/g:ComponentName}} extends React.Component {
constructor (props) {
@joadr
joadr / collection-table.jsx
Created October 12, 2016 19:02
Create Table From Collection
import React from 'react'
import { Meteor } from 'meteor/meteor'
import { createContainer } from 'meteor/react-meteor-data'
import {grey400} from 'material-ui/styles/colors'
import ArrowDownward from 'material-ui/svg-icons/navigation/arrow-downward'
import {Table, TableBody, TableHeader, TableHeaderColumn, TableRow} from 'material-ui/Table'
import _ from 'underscore'
class NoItems extends React.Component {
render () {
@joadr
joadr / uploadGridFS.js
Created October 6, 2016 01:50
Upload files to gridFS server side using vsivi:file-collection meteor package
uploadImage = function (itemCode) {
// get the image link
var image = Meteor.call('getImageLink', itemCode)
// Upload to gridFs (vsivi:file-collection)
var imageStream = fc.upsertStream({ filename: itemCode + '.jpg',
contentType: 'image/jpeg',
metadata: {}
})
@joadr
joadr / truncatePrice.js
Last active October 6, 2016 01:54
Gist to truncate a chilean format.
// Original price
var price = '$2.968.945'
// remove $ and .
price = price.replace(/\$/g,'').replace(/\./g,'')
// convert to Int
price = parseInt(price)
// Divide by 1000 and truncate to remove extra digits
price = Math.trunc(price/1000)
// Format the final price
price = price*1000-10
@joadr
joadr / urlchanger.js
Created September 1, 2016 16:38
Mongo gridfs meteor url changer
// When meteor starts
Meteor.startup(function () {
// Recursive function to replace urls
function fixUrl (object) {
_.map(object, function (value, key) {
if (_.isArray(value)) {
_.map(value, function (value2, key2) {
value2 = fixUrl(value2)
})
} else if (_.isObject(value)) {