Skip to content

Instantly share code, notes, and snippets.

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

Sérgio Marcelino sergiofilhowz

🏠
Working from home
  • Brazil
View GitHub Profile
@sergiofilhowz
sergiofilhowz / buildQuizAnswer.ts
Created January 6, 2023 13:38
Fixtures sample
import { faker } from '@faker-js/faker'
import { Quiz, QuizAnswer, QuizQuestion, QuizSubmissionInput } from '../graphql'
/* istanbul ignore next: no need to cover default value */
export const buildQuizAnswer = (answer: Partial<QuizAnswer> = {}): QuizAnswer => ({
id: faker.datatype.uuid(),
createdAt: faker.datatype.datetime(),
updatedAt: faker.datatype.datetime(),
content: faker.lorem.sentence(10),
isCorrect: faker.datatype.boolean(),
{
"restartable": "rs",
"ignore": [
".git",
"node_modules/**/node_modules",
"src/__generated__"
],
"verbose": true,
"execMap": {
"js": "node"
@sergiofilhowz
sergiofilhowz / version.sh
Created November 10, 2017 02:42
use npm version to set prerelease version equal to Circle CI build number
# reads version from package.json and sets prelease equal to Circle CI build number
if [ $CI ] && [ $CIRCLE_BUILD_NUM ]
then
newversion=$(echo $npm_package_version | sed -e "s/^\([0-9]*\.[0-9]*\.[0-9]*\-[a-z]*\).[0-9]*$/\1.$CIRCLE_BUILD_NUM/")
echo "Setting version to $newversion"
# uses npm-version to set version in package.json
# see https://docs.npmjs.com/cli/version
npm version $newversion --no-git-tag-version
git add package.json
git commit -m "updated version to $newversion [ci skip]"
@sergiofilhowz
sergiofilhowz / busboy.js
Created May 19, 2016 19:27
erro no busboy
function (req, dstPath) {
var fstream,
deferred = Promise.defer();
req.pipe(req.busboy);
req.busboy.on('file', (fieldname, file) => {
fstream = fs.createWriteStream(dstPath);
file.pipe(fstream);
fstream.on('finish', () => deferred.resolve());
fstream.on('error', err => deferred.reject(err));
@sergiofilhowz
sergiofilhowz / gist:5939660
Last active December 19, 2015 10:19
Classe Utilizada para suprir problemas de LazyInitializationException e CircularReferenceException durante a deserialização no VRaptor
import java.util.Iterator;
import org.hibernate.LazyInitializationException;
import com.thoughtworks.xstream.converters.Converter;
import com.thoughtworks.xstream.converters.MarshallingContext;
import com.thoughtworks.xstream.core.TreeMarshaller.CircularReferenceException;
/**
*