Adem Kıvanç

PHP - Js Developer

Menü Kapat

React Pokedex

A mini-encyclopedia of Pokémon stats, types and moves.

The following technologies were used for this sample application:

Installation

npm install
npm start

To view the end result visit DEMO

Authentication with React and Node.js (Express) JWT

This is an simple application that serves an ExpressJS JWT to a React client application. Database not used in this app

Code: https://github.com/ademkivanc/react-auth

cd server
npm install
node app.js

cd client
npm install
npm start

User name : admin

Password: password

React News Reader Site Example

This is a sample news site I used to get started with ReactJS. It shows how to simply use the hooks and redux and NewsApi.

To view the end result visit DEMO

Github https://github.com/ademkivanc/react-news

Getting started

This project was bootstrapped with Create React App.

To get started simply run

npm install.

Once the installation process is done just runnpm start.

VerbalExpressions ile regular expressions artık çocuk oyuncağı

Basit ve okunaklı regex kontrolleri yazmak için geliştirilmiş güzel bir kütüphane VerbalExpressions.

Kütüphane her dil için yazılmış.

Js için olan örnek aşağıdaki gibi.

// Create an example of how to test for correctly formed URLs
var tester = VerEx()
    .startOfLine()
    .then('http')
    .maybe('s')
    .then('://')
    .maybe('www.')
    .anythingBut(' ')
    .endOfLine();

// Create an example URL
var testMe = 'https://www.google.com';

// Use RegExp object's native test() function
if (tester.test(testMe)) {
    alert('We have a correct URL'); // This output will fire
} else {
    alert('The URL is incorrect');
}

console.log(tester); // Outputs the actual expression used: /^(http)(s)?(\:\/\/)(www\.)?([^\ ]*)$/

Nightmare kullanarak facebook crawler yapmak

Nightmare üst düzey bir tarayıcı otomasyon javascript kütüphanesi. Nightmare Electron altyapısını  kullanarak, crawling ve test otomasyonu yazmanızı kolaylaştıran bir kütüphane.

Örnek olarak,  facebook new feed (giriş sayfası) gönderilerini  ayrıştıralım (parsing) .

Github

const Nightmare = require("nightmare");
const vo = require('vo');

const nightmare = Nightmare({
    show: true,
    typeInterval: 20,
    waitTimeout: 60000,
    gotoTimeout: 60000
});

var run = function*() {

    yield nightmare
        .viewport(1024, 768)
        .goto('https://www.facebook.com')
        .type('#email', 'xxx@xxx.com')
        .type('#pass', 'xxxxx')
        .click('#loginbutton input')
        .wait('div[role=feed]')
        .evaluate(function () {
            window.document.body.scrollTop = document.body.scrollHeight;
        })
        .wait(3000);

    //todo we can make infinite loop
    for (var i = 0; i < 2; i++) {

        yield nightmare
            .evaluate(function () {
                var content = [];
                document.querySelectorAll('div[role=feed] .fbUserPost').forEach(function (element) {
                    if (element.querySelector('h5')) {

                        var postVideo = null, postImage = null;

                        if (element.querySelector('video')) {
                            postVideo = element.querySelector('video').src
                        }

                        if (element.querySelector('a img')) {
                            postImage = element.querySelector('a img').src
                        }

                        content.push({
                            text: element.querySelector('.userContent').innerText,
                            video: postVideo,
                            image: postImage,
                            user: {
                                name: element.querySelector('h5').innerText,
                                link: element.querySelector('h5 a').href
                            }
                        })
                    }
                });
                return content;
            })
            .then(function (result) {
                console.log(result)
            });

        yield nightmare
            .refresh()
            .evaluate(function () {
                window.document.body.scrollTop = document.body.scrollHeight;
            })
            .wait('div[role=feed]')
            .wait(3000)
    }
    yield nightmare.end();
};

vo(run)(function (err) {
    if (err) {
        console.dir(err);
    }
    console.log('done');
});

Vue.js ile mobil uygulama geliştirme ortamları

Hibrit mobil uygulamalar gittikçe yaygınlaşıyor. Vujs için hibrit uygulama geliştirme ortamlarını şöyle sıraladım.

Data Gif Maker Released By Google News Lab

For details https://www.blog.google/topics/journalism-news/make-your-own-data-gifs-our-new-too/
Tool https://datagifmaker.withgoogle.com/

Creating basic Nodejs and Express Web App

STEP 1 – INSTALLATION NODE JS

OPERATING SYSTEMINSTRUCTIONS
OS XThe easiest way to install Node.js on OS X is to use the official installer from nodejs.org. You can also use Homebrew if you prefer.
WindowsThe easiest way to install Node.js on Windows is the official installer from nodejs.org. You can also use Chocolatey if you prefer.
LinuxThe exact instructions to install Node.js vary by distribution. Find instructions for yours here.

 

Devam

Cache Permissions and Roles with Entrust Laravel

Don’t forget for performance: ‘ttl’ => 60, is missing in config/cache.php

Entrust is a succinct and flexible way to add Role-based Permissions to Laravel 5.

Tips on Laravel 5 authentication views

As standard template folders views/auth/login.blade.php and register.blade.php set the auth.

Add loginView and registerView properties so you can switch between templates.

 

/app/Http/Auth/AuthController.php

class AuthController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Registration & Login Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles the registration of new users, as well as the
    | authentication of existing users. By default, this controller uses
    | a simple trait to add these behaviors. Why don't you explore it?
    |
    */

    use AuthenticatesAndRegistersUsers, ThrottlesLogins;

    /**
     * Where to redirect users after login / registration.
     *
     * @var string
     */
    protected $redirectTo = '/';

    /**
     * Show the application login / registration form.
     *
     * @var string
     */
    protected $loginView = 'template1.login';
    protected $registerView = 'template1.register';

    /**
     * Create a new authentication controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        //switch templates
        $this->loginView = config('template.name').".login";
        $this->registerView = config('template.name').".register";
        
        $this->middleware('guest', ['except' => 'logout']);
    }



© 2024 Adem Kıvanç. Tüm hakları saklıdır.

Tema yapımcısı Anders Norén.