Skip to content

Instantly share code, notes, and snippets.

View onel0p3z's full-sized avatar
🏠
Working from home

Juan Lopez onel0p3z

🏠
Working from home
View GitHub Profile
<html>
<head>
<link type="stylesheet" src="style.css" />
</head>
<body>
<section>
<article>
<h2>Article title</h2>
<p>some textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome text </p>
</article>
@onel0p3z
onel0p3z / centered.html
Created June 17, 2013 15:59
How to REALLY center an HTML element (via CSS position absolute/fixed) from http://codepen.io/elad2412/pen/pkaIy
<html>
<body>
<style>
.popup{
position:fixed;
left:50%;
}
.popup .wrapper{
position:relative;
@onel0p3z
onel0p3z / datepicker.html
Created June 11, 2013 15:45
Date picker w/ jQuery UI
<html>
<head>
<title>Date picker</title>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/base/jquery-ui.css"/>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
</head>
<body>
<form>
<input id="datepicker" name="inf_field_Birthday" type="text" />

Creating a remote Git repository

  • Ensure you can ssh user@targetserver successfully
    • Public/private keys are a smart choice here
  • On targetserver
    • Example here assumes all Git repository users are members of a gitusers group, adjust to suit
    • mkdir -p ~/path/to/repository
    • cd ~/path/to/repository
    • git init --bare --shared=group
  • Switch --shared=group will add core.sharedrepository = 1 to the repositories ~/path/to/repository/config file
@onel0p3z
onel0p3z / Add a second HDD
Last active December 17, 2015 15:29
From, my HOW TO's
Add a second HDD
In this tutorial we will add a second hard drive to our machine running Debian linux.
If you have just added a virtual disk, make sure you restart the virtual machine before mounting the new disk.
First we'll have to find out what the device name is for this disk
@onel0p3z
onel0p3z / image-getter.js
Created April 24, 2013 23:12
Parses HTML files in folder "Templates", looks for IMG tags, gets SRC attribute, and downloads images to current folder. Not the best way but it worked for me. Also can create a file with links of images. //TIPS from http://maxogden.com/scraping-with-node.html
var $ = require('cheerio'),
_ = require('underscore'),
request = require('request'),
// If you want to create a file
images = [],
path = require('path'),
dir = path.join(__dirname,'\Templates'),
fs = require('fs'),
GetImage = function(file){
var HtmlFile = fs.readFileSync(file).toString(),
@onel0p3z
onel0p3z / html-escape.js
Last active December 16, 2015 08:49
Simple HTML encoding for JSON-like objects when used in a query string (GET) UPDATE: I just found out of escape() ... just a bit late ...
function htmlEscape(str) {
return String(str)
.replace(/{/g, '%7B')
.replace(/"/g, '%22')
.replace(/:/g, '%3A')
.replace(/}/g, '&7D')
.replace(/,/g, '%2C')
.replace(/@/g, '%40')
.replace(/\\/g, '')
.split(' ').join('+')
@onel0p3z
onel0p3z / create-tree.js
Created April 9, 2013 22:04
From SO#15909638, I whipped this for loop to create a tree-like structure to create a menu using http://jsfiddle.net/zzal/qdvuN/10/ as example
var PlaceHolder = "PlaceHolder";
var myArr =
[{id:5, parentid:0, text:PlaceHolder},
{id:6, parentid:0, text:PlaceHolder},
{id:7, parentid:0, text:PlaceHolder},
{id:8, parentid:7, text:PlaceHolder},
{id:9, parentid:7, text:PlaceHolder},
{id:10, parentid:5, text:PlaceHolder},
{id:11, parentid:5, text:PlaceHolder},
{id:12, parentid:7, text:PlaceHolder},