Skip to content

Instantly share code, notes, and snippets.

View kafkadev's full-sized avatar
🏠
Working from home

Gokhan Celik kafkadev

🏠
Working from home
View GitHub Profile
@kafkadev
kafkadev / JSON with JS.md
Created September 18, 2017 11:50
Access local JSON data with Javascript

What

An updated guide/collection of guides on how to access JSON data with JavaScript

Original Question on Stack Exchange.


Example 1

For reading the external Local JSON file (data.json) using java script

@kafkadev
kafkadev / socket-io-ws.js
Created September 15, 2017 16:30
socket.io ws
require('socket.io-client')('wss://myserver:port/ws', { transports: ['websocket'], rejectUnauthorized: false });
@kafkadev
kafkadev / typeof.js
Created September 8, 2017 18:21
typeof javascript
function empty(v) {
let type = typeof v;
if(type === 'undefined') {
return true;
}
if(type=== 'boolean') {
return !v;
}
if(v === null) {
return true;
@kafkadev
kafkadev / run-multiple-redis-instances.md
Created August 30, 2017 01:20 — forked from jarvys/run-multiple-redis-instances.md
run multiple redis instances on the same server for centos
  • create a new redis .conf file
$ cp /etc/redis.conf /etc/redis-xxx.conf
  • edit /etc/redis-xxx.conf, illustrated as below
...
@kafkadev
kafkadev / python_executable.py
Created August 5, 2017 20:13 — forked from vasishtduddu/python_executable.py
Python script to exe converter
from cx_Freeze import setup, Executable
setup(name='name',
version='0.1',
description='description',
executables = [Executable("name of the script to convert")]
)
# run using: python <name of this file.py> build
@kafkadev
kafkadev / goals.md
Created July 31, 2017 23:27 — forked from shimondoodkin/goals.md
plain vanilla node.js intro tutorial to learn a lot in the shortest time.

The plan is to take a simple nodejs server. and add to it simple file serving capabilities. also to have a custom responce to a certien url. to be able to make a simple api in addition of serving files.

goals:

  • to learn read the documentation
  • to understand the whole concept
  • to use some api for hands on expirience
  • streach goal: learn basic npm usage.
@kafkadev
kafkadev / json_stringify_circular_for_angular.js
Created July 31, 2017 12:22 — forked from brakmic/json_stringify_circular_for_angular.js
AngularJS-Module: Stringify JSON Objects with circular dependencies
(function () {
/* converted by @brakmic */
/* original code: https://github.com/isaacs/json-stringify-safe */
/* usage example:
*
*angular.module("myModule", ['jsonStringify'])
* .controller("MainCtrl", ['StringifyJsonService', MainCtrl]);
*
import React from ‘react’; import { findDOMNode } from ‘react-dom’; import $ from ‘jquery’; class FullDesc extends React.Component { constructor() { super(); } handleToggle = () => { const el = findDOMNode(this.refs.toggle); $(el).slideToggle(); }; render() { return ( <div className=”long-desc”> <ul className=”profile-info”> <li> <span className=”info-title”>User Name : </span> Shuvo Habib </li> </ul> <ul className=”profile-info additional-profile-info-list” ref=”toggle”> <li> <span className=”info-email”>Office Email</span> me@shuvohabib.com </li> </ul> <div className=”ellipsis-click” onClick={this.handleToggle}> <i className=”fa-ellipsis-h”/> </div> </div> ); } } export default FullDesc;
@kafkadev
kafkadev / datauri.php
Created July 26, 2017 22:08 — forked from rodneyrehm/datauri.php
PHP: datauri.php - convert image to data-uri
#!/opt/local/bin/php
<?php
/*
1) replace the shebang (first line) with the path to your php binary
(probably something like /usr/bin/php)
2) move the file to /usr/local/bin/datauri.php
(this should be in your PATH)
3) chmod ugo+rx /usr/local/bin/datauri.php
(make the script executable for everyone)
#!/opt/local/bin/php
<?php
/*
1) replace the shebang (first line) with the path to your php binary
(probably something like /usr/bin/php)
2) move the file to /usr/local/bin/datauri.php
(this should be in your PATH)
3) chmod ugo+rx /usr/local/bin/datauri.php
(make the script executable for everyone)