Skip to content

Instantly share code, notes, and snippets.

Yoav Baras baras

  • Webpals Group
  • Tel Aviv, Israel
Block or report user

Report or block baras

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
baras / get_custom_post_types_and_page_templates
Created Jan 16, 2019
Get custom post types and page templates in php
View get_custom_post_types_and_page_templates
function get_custom_post_types_and_page_templates() {
global $wp_post_types;
// Public custom post types.
$args = [
'public' => true,
'_builtin' => false,
// Get the lists and add a suffix which denotes the type, Page or Post.
baras / qstring.js
Last active Dec 24, 2018
Get the URL query string parameters in JavaScript.
View qstring.js
var queryString = {};"&").forEach(function (pair) {
if (pair.length) {
var parts = pair.split("=");
queryString[parts[0]] = decodeURIComponent(parts[1].replace(/\+/g, " "));
baras / decode_url.js
Created Dec 16, 2018
Decode a URL in the browser address bar.
View decode_url.js
if (history.pushState) { //IE10+
var newurl = window.location.protocol + "//" + + window.location.pathname + decodeURIComponent(;
View wrap-letters.js
* Wrap each letter of text in the given element in a span tag.
$.fn.lettering = function () {
this.each(function (index) {
var elem = $(this),
characters = elem.text().split("");
View mobile_page_form.html
<div class="c-forms w50">
<div class="row no-gutters">
<div class="col-md-6 col-xl-4 pad-by-location">
<label> Full Name* [text* full_name placeholder "Full Name"] </label>
<div class="col-md-6 col-xl-4 pad-by-location">
<label> Company Name* [text* company_name placeholder "Company Name"] </label>
View Machine name
* Convert human readable strings to machine names.
* @param string $str
* The string to convert.
* @return string
* The converted string.
function machine_readable( $str ) {
baras / smb.conf
Created Aug 26, 2018
/etc/samba/smb.conf settings to share a folder on a Linux VirtualBox to be accessed from the Windows host.
View smb.conf
Add this to the bottom of the file:
comment = another share
path = /var/www
guest ok = yes
browseable = yes
read only = no
baras / smallest-positive-int-solution.php
Last active Oct 8, 2018
Given an array A of N integers, returns the smallest positive integer (greater than 0) that does not occur in A.
View smallest-positive-int-solution.php
* Finds the smallest positive integer which does not exist in an array.
* @param array $a
* The array to check.
* @return int
* The smallest positive integer not found in $a.
function solution2(array $a) {
You can’t perform that action at this time.