Skip to content

Instantly share code, notes, and snippets.

View robertovg's full-sized avatar

Roberto Vázquez González robertovg

  • Senior Software Engineer
  • Conil de la Frontera
  • 15:04 (UTC +02:00)
View GitHub Profile
@robertovg
robertovg / machine.js
Created March 24, 2020 10:38
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@robertovg
robertovg / flatArray
Created January 5, 2018 17:05
Function to flat arrays
// const a = [1, [], [2, 3, [4],
// [5],
// [1, 2, 3, 4, [5, [6],
// [4], [],
// ]]
// ], 3, 6];
// const b = [1, 2, 3];
/**
* Function to flat arrays
@robertovg
robertovg / gist:f76939a78f58eef32408
Created February 2, 2016 18:09 — forked from sjwilliams/gist:3903157
Sublime Text 2 Cheat Sheet. Shortcuts, including Vintage mode.

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘KB toggle side bar
⌘⇧P command prompt
⌃ ` python console
⌘⇧N new window (useful for new project)
app.directive('infiniteScroll', [
'$rootScope', '$window', '$timeout', function($rootScope, $window, $timeout) {
return {
link: function(scope, elem, attrs) {
var checkWhenEnabled, handler, scrollDistance, scrollEnabled;
$window = angular.element($window);
elem.css('overflow-y', 'scroll');
elem.css('overflow-x', 'hidden');
elem.css('height', 'inherit');
scrollDistance = 0;
@robertovg
robertovg / test-runner.html
Created August 12, 2013 11:53
mochaPhantomJS-runner
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Title &amp; Meta -->
<title>Frontend tests</title>
<meta charset="utf-8">
<!-- Stylesheets -->
<link rel="stylesheet" href="lib/mocha/mocha.css">
</head>
@robertovg
robertovg / .py
Created July 30, 2013 06:15
python.py
#!/usr/bin/env python
@robertovg
robertovg / gist:3813004
Created October 1, 2012 16:56 — forked from padolsey/gist:527683
JavaScript: Detect ie
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}