Skip to content

Instantly share code, notes, and snippets.

View gabrielhpugliese's full-sized avatar

Gabriel H Pugliese gabrielhpugliese

View GitHub Profile
@gabrielhpugliese
gabrielhpugliese / meteor-windows-vagrant-tutorial.md
Last active April 19, 2022 14:37
Tutorial for running Meteor in Windows using Vagrant

Tutorial: Meteor in Windows using Vagrant

BEFORE YOU CONTINUE:

  • Now, Meteor runs in any Windows without any line of this tutorial. Just download the Meteor binary! Yay!!
  • mrt is no longer used with Meteor 1.0

These days some people were discussing at meteor-talk group about running Meteor at Windows and I’ve recommended them using Vagrant. It’s a very developer-friendly piece of software that creates a virtual machine (VM) which let you run any operating system wanted and connect to it without big efforts of configuration (just make the initial installation and you have it working).

Many packages (I've tested) for running Meteor+Vagrant fails because Meteor writes its mongodb file and also other files inside local build folder into a shared folder between the Windows host and the Linux guest, and it simply does not work. So I've put my brain to work and found a solution: do symlinks inside the VM (but do not use ln. Use mount so git can follow it). It’s covered on

@gabrielhpugliese
gabrielhpugliese / googledrive.js
Last active August 25, 2020 08:22
Google Drive
var CLIENT_ID = '454038495802.apps.googleusercontent.com';
var SCOPES = 'https://www.googleapis.com/auth/drive';
/**
* Called when the client library is loaded to start the auth flow.
*/
function handleClientLoad() {
window.setTimeout(checkAuth, 1);
}
{
heating: [
{
cost: 4.11,
date: 'Di.'
},
{
cost: 4.11,
date: 'Mi.'
},
@gabrielhpugliese
gabrielhpugliese / gulpfile.js
Last active January 31, 2019 09:08
Django collectstatic + Gulp watch
var gulp = require('gulp');
var shell = require('gulp-shell');
var changed = require('gulp-changed');
gulp.task('collectstatic', function () {
return gulp.src('static/**/*.*')
.pipe(changed('YOURAPP/static/'))
.pipe(shell([
'python manage.py collectstatic --noinput'
@gabrielhpugliese
gabrielhpugliese / bench.txt
Last active December 13, 2018 16:50
Python 3.4 asyncio + aiohttp parallel vs sequential requests
$python parallel.py
[13:48:59:130701] Doing GET request to http://google.com
[13:48:59:134958] Doing GET request to http://facebook.com
[13:48:59:135498] Doing GET request to http://twitter.com
[13:48:59:136174] Doing GET request to http://slack.com
****** STATUSES: [{'status': 200, 'url': 'http://google.com'}, {'status': 200, 'url': 'http://twitter.com'}, {'status': 200, 'url': 'http://slack.com'}, {'status': 200, 'url': 'http://facebook.com'}]
$python sequential.py
[13:49:04:078752] Doing GET request to http://google.com
[13:49:04:232725] Doing GET request to http://facebook.com
http {
// there is other config here
server {
listen 443;
access_log /var/log/nginx/meteorapp.access.log;
error_log /var/log/nginx/meteorapp.error.log;
04ea31fa598b02dcad3fff9b55f7bbae770728a192332fddb5e22e77bfac37cf73c767a571926b42588715d45c13dde1e27b79c5e0dca9c802d1709f718bcdd430;rabc
import {
compose,
findIndex,
pullAt,
curry,
} from 'lodash/fp';
const MY_LIST = [/* items here */];
const removeFromList = curry((itemToRemove, list) => compose(
import {
compose,
findIndex,
cond,
} from 'lodash/fp';
const MY_LIST = [/* items here */];
const findMyItemIndex = findIndex(item => item === 'MY_ITEM');
const changeItemToSomething = () => // returns NEW object (immutable)
import {
compose,
findIndex,
cond,
} from 'lodash/fp';
const MY_LIST = [/* items here */];
const findMyItemIndex = findIndex(item => item === 'MY_ITEM');
const changeItemToSomething = () => // returns NEW object (immutable)