Skip to content

Instantly share code, notes, and snippets.

View erezLieberman's full-sized avatar

Erez Lieberman erezLieberman

View GitHub Profile
@erezLieberman
erezLieberman / test.js
Created February 1, 2019 13:21
test.js
import React, { Component } from "react";
import "./App.css";
import {
Card,
CardText,
CardBody,
CardTitle,
Button,
Form,
FormGroup,
@erezLieberman
erezLieberman / Basic for test component method in react + jest + enzyme.js
Last active August 22, 2018 12:02
Basic for test component method in react + jest + enzyme because our decorator
import React from 'react';
import _ from 'lodash';
import { mount, shallow } from 'enzyme';
import NameOfComponent from '../src/NameOfComponent';
describe('NameOfComponent Basic: ', () => {
it('should verified that component is exits', () => {
const wrapper = mount(
<NameOfComponent />
@erezLieberman
erezLieberman / gist:f2ac621fefbac7219abd
Last active August 21, 2017 15:09
embed video to wp acf
<div class="videoWrapper">
<!-- from here: http://css-tricks.com/NetMag/FluidWidthVideo/Article-FluidWidthVideo.php -->
<?php if( get_field('youtube_url') ){
$embed_code = wp_oembed_get( get_field('youtube_url') );
echo $embed_code;
} ?>
</div>
@erezLieberman
erezLieberman / stop and play youtube player inside bootstrap modal.js
Last active June 14, 2017 09:36
stop and play youtube player inside bootstrap modal
$('.hp_videos .modal').on('hidden.bs.modal', function (e) {
var url = $(this).find('iframe').attr('src');
$(this).find('iframe').attr('src',url);
console.log('close');
});
$('.hp_videos .modal').on('shown.bs.modal', function (e) {
var url = $(this).find('iframe').attr('src');
$(this).find('iframe').attr('src',url);
console.log('open');
});
@erezLieberman
erezLieberman / svg_acf_image.php
Created December 16, 2014 10:58
allow svg in acf image field
<?php $image = get_sub_field('features_img');
if( !empty($image) ):
// vars
$url = $image['url'];
$title = $image['title'];
$alt = $image['alt'];
$caption = $image['caption'];
@erezLieberman
erezLieberman / diffrents-font-by-unicode-range.scss
Created December 29, 2016 10:47
diffrents font by unicode-range
@font-face {
font-family: 'Narkis Block M F';
src: url('fonts/NarkisBlock-Medium.otf');
font-weight: 500;
}
@font-face {
font-family: 'Narkis Block M F';
src: url('fonts/NarkisBlock-Regular.otf');
font-weight: 400;
@erezLieberman
erezLieberman / Udacity.com-Intro-to-Computer-Science-Course-Answers - Converting Seconds.py
Last active October 14, 2016 10:17
Udacity.com-Intro-to-Computer-Science-Course-Answers - Converting Seconds
# Write a procedure, convert_seconds, which takes as input a non-negative
# number of seconds and returns a string of the form
# '<integer> hours, <integer> minutes, <number> seconds' but
# where if <integer> is 1 for the number of hours or minutes,
# then it should be hour/minute. Further, <number> may be an integer
# or decimal, and if it is 1, then it should be followed by second.
# You might need to use int() to turn a decimal into a float depending
# on how you code this. int(3.0) gives 3
#
# Note that English uses the plural when talking about 0 items, so
@erezLieberman
erezLieberman / gist:9228890
Last active May 2, 2016 01:05
youtube player from acf field
<?php if (get_field('youtubeURL')) {
$mystring = get_field('youtubeURL');
$parts = explode("=",$mystring);
$mystring = $parts['1']; ?>
<iframe width="440" height="228" src="//www.youtube-nocookie.com/embed/<?php echo $mystring ; ?>" frameborder="0" allowfullscreen></iframe>
<?php } ?>
@erezLieberman
erezLieberman / gist:243653e90c78cd336a56
Last active April 29, 2016 22:28
custom icon in acf google maps
// create marker
var templateDir = "<?php bloginfo('stylesheet_directory') ?>";
var iconBase = templateDir + '/images/map_icon.svg';
var marker = new google.maps.Marker({
position : latlng,
map : map,
icon: iconBase
});