Skip to content

Instantly share code, notes, and snippets.

View FrancoB411's full-sized avatar

Franco Barbeite FrancoB411

View GitHub Profile
@FrancoB411
FrancoB411 / Ubuntu VNC Playbook
Created May 21, 2018 01:26
VNC_ubuntu_18.04_Google_cloud.md
# Get VNC Server running on Google Cloud with Ubuntu 18.04
[Create a new Google Clound Instance](https://console.cloud.google.com/compute/instances?project=tenso-flow&folder&organizationId&duration=PT1H)
## Install a Desktop
In this case ubuntu-desktop
### Install Tasksel
`
sudo apt-get install aptitude tasksel
`
@FrancoB411
FrancoB411 / proxy
Last active February 27, 2016 03:57
const args = ['node', '--proxy='];
const flags = ['proxy'];
let hasProxy = (arg) => flags.find(flag => arg.includes(flag));
if(args.find(hasProxy)) {
console.log("proxy");
} else {
console.log("error");
}
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
@FrancoB411
FrancoB411 / hash_transform.rb
Last active August 29, 2015 14:00
Hash transform composing functions
# setup data
data1 = {1 => %W{ A B C D E} , 2 => %W{ A B C D E }, 3 => %W{ A B C D E }, 4 => %W{ A B C D E } }
list = data1[1]
def swap_list_values_to_keys(key, list)
list.reduce({}) { |a, value| a.merge({key => value.downcase}.invert) }
end
# p swap_list_values_to_keys(1, list)
# => {"a"=>1, "b"=>1, "c"=>1, "d"=>1, "e"=>1}
// `unit` is `return` from Haskell
// `bind` is `>>=` from Haskell, or `flatMap` from Scala
var None = {
bind: function (fn) { return this; },
unit: function (v) { return Option(v); },
getOrElse: function (elseValue) { return elseValue; }
};
var Some = function (value) {
@FrancoB411
FrancoB411 / sublime_text_user_settings
Last active August 29, 2015 13:57
sublime_text_user_settings
// packages
//-----------------------
// alignment
// ruby-eval
// sublime linter
// origami
// autofilename
// javascript es6 syntax highlighting
// gutter color
// git gutter
@FrancoB411
FrancoB411 / responsive abbreviations and links
Last active January 3, 2016 20:09
mobile friendly responsive abbreviation elements
@FrancoB411
FrancoB411 / rspec_cheatsheet
Created November 19, 2013 05:06
Rspec Cheatsheet
# Rspec Syntax Cheat Sheet
## Stub:
Replacing a method with code that returns a specified result.
weapon.stub(:slice)
Stubbing to avoid hitting database
Before: context block hits DB twice
@FrancoB411
FrancoB411 / .bashrc heart prompt
Last active December 16, 2015 06:09
my .bashrc with custom prompt
### Add RVM to PATH for scripting
PATH=$PATH:$HOME/.rvm/bin
### Add bin to my PATH
PATH=$HOME/bin:$PATH
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
@FrancoB411
FrancoB411 / gist:3757824
Created September 20, 2012 19:22 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt