Skip to content

Instantly share code, notes, and snippets.

Mario Gutierrez mgutz

  • Seattle, WA
Block or report user

Report or block mgutz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mgutz
mgutz / colors.js
Last active May 30, 2019
svelte3 actions and getters using nested object store
View colors.js
import {readable, writable} from 'svelte/store';
// could be its own module
const util = {
_root: null,
// similar to createSelector but instead returns a reactive variable
createGetter(store, fn, initialData) {
return readable(initialData, set => {
store.subscribe(state => set(fn(state, this._root)));
@mgutz
mgutz / main.yaml
Created Dec 21, 2017
ansible script for i3
View main.yaml
- name: install i3 and custom utils
become: yes
apt: pkg={{item}}
with_items:
- hsetroot
- i3
- rofi
- xsel
- rxvt-unicode-256color
View gist:f1387146c957a6bf2c48
Get scope of current file
```
atom.workspace.getActiveEditor().getGrammar().scopeName
```
View setup-vmware-image-with-static-IP.markdown

How to setup your VMWare Fusion 6 images to use static IP addresses on Mac OS X

At Crush + Lovely, we use Railsmachine's Moonshine to automate the configuration of our servers. When writing our deployment recipes, VMWare Fusion's ability to take snapshots and rollback to these snapshots is a huge timesaver because it takes just seconds to roll a server image to it's original state.

When you're just configuring a single server, having a static IP address for your server image isn't too important, but when you're configuring multi-server setups, it can be useful to duplicate a number of server images and give each a static IP address so you can consistently deploy to them. While not documented well at all, it turns out that this is relatively easy to accomplish in four simple steps.

1. Determine the MAC address of your guest machine

Let's say you have a guest machine with the name ubuntu-lucid-lynx-base

View gist:8414644
module.exports = function(gee) {
return {
scripts: {
src: "src/**/*.js",
pipe: function() { return [jshint(), concat(), uglify(), dest('dist/all.js')] }
}
};
};
// to watch? simple, add -w flag
@mgutz
mgutz / Projfile.coffee
Last active Jan 3, 2016
Projmate built on gulp filters syntax. Projmate can be run in imperative mode meaning it will run JavaScript or CoffeeScript files with the usual require and function goodness. It also runs project files in JSON in JSON, CSON or YAML format. The JSON mode is for the Projmate GUI. The JSON file can be edited by hand or the GUI and it is round-tri…
View Projfile.coffee
Promise = require("bluebird")
coffee = require("gulp-coffee")
dest = require("gulp").dest
less = require("gulp-less")
uglify = require("gulp-uglify")
exports.imports =
S: "./simple.coffee"
exports.project = (pm) ->
@mgutz
mgutz / gist:8343496
Last active Jan 2, 2016
The beauty of promises is they are values. Async and sync calls are handles the same within a `then` statement. In this example, async, sync and error handling are handled gracefully.
View gist:8343496
Promise = require('bluebird')
i = 0
printAsync = (cb) ->
setTimeout ->
console.log i++
cb()
, Math.floor((Math.random()*10)+1) # random 1..10
print = (action) ->
@mgutz
mgutz / pgadmin3_log_debug.md
Created Dec 21, 2013
DEBUG messages not logged in pgAdmin3 logs
View pgadmin3_log_debug.md

Problem

There's a bug in pgAdmin3 query editor which sets client_min_messages to NOTICE regardless of the setting in the options dialog.

Workaround

Run this statement once in each query editor window using DEBUG logging

SET client_min_messages to 'DEBUG1';
@mgutz
mgutz / gist:3148405
Created Jul 20, 2012
go + postgres + pq library
View gist:3148405
package mine
import (
"fmt"
_ "github.com/bmizerany/pq"
"database/sql"
"testing"
)
@mgutz
mgutz / libluv.lua
Created Feb 4, 2012
require with index.lua
View libluv.lua
### index.lua
return require("./lib/luv")
### lib/luv.lua
local luv = {}
_G.task = function(name, description, ...)
end
return luv
You can’t perform that action at this time.