Skip to content

Instantly share code, notes, and snippets.

View marcosleonel's full-sized avatar
🎯
Focusing

Marcos Leonel marcosleonel

🎯
Focusing
  • Brazil
View GitHub Profile
@dcondrey
dcondrey / WP_secondary_editor
Created July 3, 2014 04:12
Add a second TinyMCE editor to Wordpress post editor page. The second editor will look, and function exactly like the original one with full toolbar, and support for shortcodes.
/* Second Post Editor TinyMCE Editor */
class SubContentEditor {
public $meta_key = 'subcontent';
public $meta_label = 'Right Side'; // Headline above editor
public $post_type = array( 'page' ); // The post type in which the editor should display
public $wpautop = true; // Automatically create paragraphs?
function __construct() {
add_action( 'edit_form_after_editor', array( &$this, 'edit_form_after_editor' ) );
@nrollr
nrollr / MongoDB.md
Last active January 7, 2024 11:57
Install MongoDB on El Capitan

Install MongoDB on El Capitan

How to install the latest stable version of MongoDB on OS X 10.11 (El Capitan).

  • Official MongoDB install documentation: Here
  • Current Stable Release: 3.0.6

Make sure you have Homebrew installed before following the different steps documented below.
Important notice: When installing Homebrew on El Capitan there is an important article you should read first: Homebrew and El Capitan

@satoryu
satoryu / gist:495913e59bb249b060cc
Created February 6, 2016 09:28
Uninstalled mongodb manually and reinstalled it then mongodb cannot be launched with this error.
2016-02-06T18:10:44.893+0900 I CONTROL [main] ***** SERVER RESTARTED *****
2016-02-06T18:10:44.910+0900 I CONTROL [initandlisten] MongoDB starting : pid=46957 port=27017 dbpath=/usr/local/var/mongodb 64-bit host=P23722.local
2016-02-06T18:10:44.910+0900 I CONTROL [initandlisten] db version v3.2.1
2016-02-06T18:10:44.910+0900 I CONTROL [initandlisten] git version: a14d55980c2cdc565d4704a7e3ad37e4e535c1b2
2016-02-06T18:10:44.910+0900 I CONTROL [initandlisten] allocator: system
2016-02-06T18:10:44.910+0900 I CONTROL [initandlisten] modules: none
2016-02-06T18:10:44.910+0900 I CONTROL [initandlisten] build environment:
2016-02-06T18:10:44.910+0900 I CONTROL [initandlisten] distarch: x86_64
2016-02-06T18:10:44.910+0900 I CONTROL [initandlisten] target_arch: x86_64
2016-02-06T18:10:44.910+0900 I CONTROL [initandlisten] options: { config: "/usr/local/etc/mongod.conf", net: { bindIp: "127.0.0.1" }, storage: { dbPath: "/usr/local/var/mongodb" }, systemLog: { destination: "file", logAppend: true, path
@matthewoden
matthewoden / AWS Git Setup.md
Created May 22, 2016 17:48
Setting up a remote Git in AWS EC2

AWS Remote Git Setup

Get a local git repo up on an EC2 Instance.

Add youself to SSH Authentication:

Add yourself to the ssh auth agent, if you haven't already.

ssh-add path/to/your/EC2.pem

Set up destination directory:

@joseluisq
joseluisq / add_two_times.js
Last active April 16, 2024 07:06
Add two string time values (HH:mm:ss) with javascript
/**
* Add two string time values (HH:mm:ss) with javascript
*
* Usage:
* > addTimes('04:20:10', '21:15:10');
* > "25:35:20"
* > addTimes('04:35:10', '21:35:10');
* > "26:10:20"
* > addTimes('30:59', '17:10');
* > "48:09:00"
@tomnomnom
tomnomnom / alert.js
Last active July 12, 2024 13:24
Ways to alert(document.domain)
// How many ways can you alert(document.domain)?
// Comment with more ways and I'll add them :)
// I already know about the JSFuck way, but it's too long to add (:
// Direct invocation
alert(document.domain);
(alert)(document.domain);
al\u0065rt(document.domain);
al\u{65}rt(document.domain);
window['alert'](document.domain);
@jakzal
jakzal / flat_map.php
Last active July 28, 2021 16:16
Flat map in PHP
<?php
function flat_map(callable $callback, array $collection) {
return array_merge([], ...array_map($callback, $collection));
};
@zaydek-old
zaydek-old / bookmark.min.js
Last active May 28, 2024 19:18
A *simple* CSS debugger. To use, bookmark "Debug CSS" at https://zaydek.github.io/debug.css. Learn more here https://medium.freecodecamp.org/88529aa5a6a3 and https://youtu.be/2QdzahteCCs?t=1m25s (starts at 1:25)
/* debug.css | MIT License | zaydek.github.com/debug.css */ if (!("is_debugging" in window)) { is_debugging = false; var debug_el = document.createElement("style"); debug_el.append(document.createTextNode(`*:not(g):not(path) { color: hsla(210, 100%, 100%, 0.9) !important; background: hsla(210, 100%, 50%, 0.5) !important; outline: solid 0.25rem hsla(210, 100%, 100%, 0.5) !important; box-shadow: none !important; filter: none !important; }`)); } function enable_debugger() { if (!is_debugging) { document.head.appendChild(debug_el); is_debugging = true; } } function disable_debugger() { if (is_debugging) { document.head.removeChild(debug_el); is_debugging = false; } } !is_debugging ? enable_debugger() : disable_debugger();
@ralexandr
ralexandr / alpine_install_nvm.md
Last active May 30, 2024 09:10
Installing nvm on Alpine Linux

Installing nvm on Alpine Linux

Alpine Linux, unlike mainstream/traditional Linux distributions, is based on BusyBox, a very compact (~5MB) Linux distribution. BusyBox (and thus Alpine Linux) uses a different C/C++ stack to most mainstream/traditional Linux distributions - musl. There currently is no musl based binary published in the nodejs official builds but they do publish a musl based binary in the nodejs unofficial builds which they use in the node:alpine docker image. The node:alpine docker image is a potential alternative to nvm for using node on alpine linux.

For now you can override the nvm_get_arch function to return x64-musl on x64 Alpine Distributions. Currently the Node project only has unofficial builds for x64-musl. Sorry no ARM-musl/x86-musl,etc builds for now. The N

New Year Gift - Curated List of Top 75 LeetCode Questions to Save Your Time

Facebook / Eng tech lead

140 Comments

New Year Gift to every fellow time-constrained engineer out there looking for a job, here's a list of the best LeetCode questions that teach you core concepts and techniques for each category/type of problems! Many other LeetCode questions are a mash of the techniques from these individual questions. I used this list in my last job hunt to only do the important questions.

Good luck and Happy New Year!

Array