Skip to content

Instantly share code, notes, and snippets.

View oleg-webdev's full-sized avatar
🏠
Working from home

Oleg oleg-webdev

🏠
Working from home
View GitHub Profile
@oleg-webdev
oleg-webdev / react_hook.js
Last active May 22, 2019 09:01
React hoo
import React, { useState } from 'react';
export default function Greeting(props) {
const [name, setName] = useState('Alice');
function onNameChange(e) {
setName(e.target.value);
}
return (
// should be A3b3C1z2n2K1l2Y2i2
let str = 'AAAbbbCzznnKllYYii'.split('');
console.log('AAAbbbCzznnKllYYii');
let scope = '';
let tmpArr = [];
str.forEach((element, i) => {
(function(it) {
const cur = str[it];
const prev = str[it-1];
if(prev) {
@oleg-webdev
oleg-webdev / list-of-devices.txt
Last active December 23, 2017 14:57 — forked from rexlow/md
Run React Native on specific iOS simulator version
To add a simulator
Choose Hardware > Device > Manage Devices.
Xcode opens the Devices window.
At the bottom of the left column, click the Add button (+).
In the dialog that appears, enter a name in the Simulator Name text field and choose the device from the Device Type pop-up menu.
//by default
//react-native run-ios
<?php
if (!is_writable(session_save_path())) {
echo 'Session path "'.session_save_path().'" is not writable for PHP';
}
@oleg-webdev
oleg-webdev / sublime-command-line.md
Created November 11, 2017 17:31
Launch Sublime Text from the command line on OSX

Launch Sublime Text from the command line on OSX

Sublime Text includes a command line tool, subl, to work with files on the command line. This can be used to open files and projects in Sublime Text, as well working as an EDITOR for unix tools, such as git and subversion.

Requirements

  • Sublime text 2 or 3 installed in your system within Applications folder

Setup

@oleg-webdev
oleg-webdev / admin-script.js
Created October 27, 2017 16:11
Svg images Support
jQuery(document).ready(function ($){
var observer = new MutationObserver(function(mutations){
for (var i=0; i < mutations.length; i++){
for (var j=0; j < mutations[i].addedNodes.length; j++){
//get the applicable element
element = $(mutations[i].addedNodes[j]);
if(element.attr('class')){
@oleg-webdev
oleg-webdev / async_await.js
Last active October 22, 2017 16:04
async await simple example
const fetchPosts = async () => {
const res = await fetch("https://jsonplaceholder.typicode.com/posts/")
const json = await res.json()
return json
}
console.log(await fetchPosts())
@oleg-webdev
oleg-webdev / gist:e432f5fba1f5295783d42968680fd85a
Created October 11, 2017 21:03 — forked from paulallies/gist:0052fab554b14bbfa3ef
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
if ( ! function_exists( 'show_content_between_dates' ) ) {
// Usage [show_content_between_dates start_deadline="2017-08-20" end_deadline="2017-08-28"]
// Your content goes there...
// [/show_content_between_dates]
add_shortcode( 'show_content_between_dates', 'show_content_between_dates' );
function show_content_between_dates( $atts, $content = null )
{
$data = shortcode_atts( [
'start_deadline' => $atts[ 'start_deadline' ],
@oleg-webdev
oleg-webdev / README-Template.md
Created September 4, 2017 19:28 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites