Skip to content

Instantly share code, notes, and snippets.

View dongerardor's full-sized avatar
💭

Gerardo Rodríguez dongerardor

💭
View GitHub Profile
@dongerardor
dongerardor / update-vscode.sh
Created November 8, 2024 11:42
Update VS Code in Linux
#!/bin/bash
wget 'https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64' -O /tmp/code_latest_amd64.deb
sudo dpkg -i /tmp/code_latest_amd64.deb
@dongerardor
dongerardor / update-chrome.sh
Created November 8, 2024 11:40
Update Chrome in Linux
#!/bin/bash
# chmod +x update-chrome.sh para asignar permiso de ejecucion
sudo apt update && sudo apt install google-chrome-stable -y
@dongerardor
dongerardor / auto-update-vscode.sh
Created March 7, 2024 22:44
bash script to update VS Code in Debian
#!/bin/bash
# Update vscode in Linux (Debian, Ubuntu)
# creating a bash file: 'auto-update-vscode.sh' with this content.
#
# Before the script can be run, the file must have executable permissions.
### chmod +x auto-update0-vscode.sh
#
# and then run the file:
### ./auto-update-vscode.sh # being in file dir
@dongerardor
dongerardor / backbone Osmani boilerplate .html
Last active April 11, 2017 01:00
Backbone Osmani boilerplate
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://underscorejs.org/underscore-min.js"></script>
@dongerardor
dongerardor / Text area auto height
Last active August 29, 2015 14:22
Text area auto height
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Textarea</title>
<script src='http://code.jquery.com/jquery-2.1.4.min.js'></script>
<script src='chance.js'></script>
<script type="text/javascript">
$(function(){
@dongerardor
dongerardor / gist:dc178bb37dc24ad44853
Created August 22, 2014 01:53
Asking for Mozilla Firefox
var FF = !(window.mozInnerScreenX == null);
if (FF) {
//custom logic
}
@dongerardor
dongerardor / detect mobile
Created August 21, 2014 09:04
Detecting mobile devices
function detectmob() {
if( navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)
){
return true;
@dongerardor
dongerardor / indexOf IE
Created March 25, 2013 19:44
javascript array method "indexOf" doesn't exists in IE, so this code implements this.
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(obj, start) {
for (var i = (start || 0), j = this.length; i < j; i++) {
if (this[i] === obj) { return i; }
}
return -1;
}
}
@dongerardor
dongerardor / preloadImages.js
Created February 22, 2013 17:28
Preload images. Providing an array of path to images, we create image objects which preloads them.
(function($) {
var cache = [];
// Arguments are image paths relative to the current page.
$.preLoadImages = function() {
var args_len = arguments.length;
for (var i = args_len; i--;) {
var cacheImage = document.createElement('img');
cacheImage.src = arguments[i];
cache.push(cacheImage);
}
@dongerardor
dongerardor / CapitaliseFirstLetter
Created February 19, 2013 19:00
Capitalise first letter
function capitaliseFirstLetter(string){
return string.charAt(0).toUpperCase() + string.slice(1);
}