Skip to content

Instantly share code, notes, and snippets.

View lucasmenendez's full-sized avatar
Reinventing the wheel

Lucas Menéndez lucasmenendez

Reinventing the wheel
View GitHub Profile
@lucasmenendez
lucasmenendez / directive.js
Created October 19, 2015 10:53
AngularJS Simple Calendar Directive
app.directive("calendar", function() {
return {
restrict: "E",
templateUrl: "template.html",
scope: {
month: "=",
year: "=",
},
link: function(scope) {
var getCalendar = function(y, m) {
@lucasmenendez
lucasmenendez / calendar.js
Last active December 17, 2015 10:03
Calendar JS function
function getCalendar(year, month) {
var today = new Date(),
date = new Date(parseInt(year), parseInt(month) - 1),
weeks = new Array();
var index = new Date(date.getTime()),
lastDay = new Date(year, parseInt(month), 0);
index.setDate(index.getDate() - index.getDay());
@lucasmenendez
lucasmenendez / get_nested_menu_wp.php
Last active August 1, 2016 10:47
Use: get_menu('<string : menu_name>') to get nested array or print_menu('<string : menu_name>') to print it.
<?php
function get_menu($menu, $items = null, $id = 0) {
if (is_null($items) && $id == 0) {
$items = array();
$menu = wp_get_nav_menu_items($menu);
foreach ($menu as $menu_item) {
$items[] = array(
'id' => $menu_item->ID,
'title' => $menu_item->title,
@lucasmenendez
lucasmenendez / nginxproxy.md
Created June 30, 2016 15:01 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@lucasmenendez
lucasmenendez / .vimrc.i3
Last active June 9, 2018 15:31
Minimal vim conf.
set number
set tabstop=4
set shiftwidth=4
set softtabstop=4
set autoindent
set smartindent
set colorcolumn=80
set textwidth=0
set nowrap
@lucasmenendez
lucasmenendez / customvhost.md
Created March 5, 2017 18:28
Apache2 vhost on $HOME folder

Apache2 http://workspace/ vhost on $HOME folder

  • Create workspace folder:
	/home/{$USERNAME}/path/to/folder
  • Granting permissions:
	chmod R 755 /home/{$USERNAME}/path/to/folder
@lucasmenendez
lucasmenendez / brown-to-universal.json
Last active July 18, 2017 18:35
Brown POS Tagging corpus tag set to universal tag set.
{
"adv": [
"*",
"*-hl",
"*-nc",
"*-tl",
"ql",
"ql-hl",
"ql-nc",
"ql-tl",
/**
* Created by lucas.menendez on 12/5/17.
*/
(function() {
var links = document.querySelectorAll('a[href*="#"]');
for (var i = 0; i < links.length; i++)
links[i].addEventListener('click', clickHandler);
function clickHandler(e) {
e.preventDefault();
<script src="http.js"></script>
<script src="example.js"></script>
@lucasmenendez
lucasmenendez / join_wordlist.py
Created October 23, 2017 10:44
Merge wordlist files. Usage: join_wordlist.py [-h] input1 input2 output
from argparse import ArgumentParser
def init():
parser = ArgumentParser()
parser.add_argument("input1", help="First input file path.")
parser.add_argument("input2", help="Second input file path.")
parser.add_argument("output", help="Output file (will be overwritten).")
args = parser.parse_args()
return args.input1, args.input2, args.output