Skip to content

Instantly share code, notes, and snippets.

View jurosh's full-sized avatar

Jurosh jurosh

View GitHub Profile
@ECHO OFF
ECHO Upload to FTP
ECHO Written by: Jason Faulkner
ECHO SysadminGeek.com
ECHO. Improved by ecos
ECHO.
REM Usage:
REM UploadToFTP [/L] FileToUpload
REM
Windows PowerShell
Copyright (C) 2015 Microsoft Corporation. All rights reserved.
PS C:\Development\Server\EasyPHP\data\localweb> docker-machine ls
error getting URL for host default: Something went wrong running an SSH command!
command : ip addr show dev eth1
err : exit status 255
output :
NAME ACTIVE DRIVER STATE URL SWARM
@jurosh
jurosh / gist:dd7250f5f4de9d562f6e
Last active February 4, 2016 09:46
PHP iterate by reference - weaknesses
<?php
http://stackoverflow.com/questions/3307409/php-pass-by-reference-in-foreach
$a = array ('zero','one','two', 'three');
foreach ($a as &$v) {
// nothing
echo $v . PHP_EOL;
}
@jurosh
jurosh / gist:bcb18285b1d95824cd41ae33677835eb
Last active May 9, 2016 17:25
Reactjs stateless function & class components
// Read more:
// https://camjackson.net/post/9-things-every-reactjs-beginner-should-know
// https://facebook.github.io/react/docs/component-specs.html
// https://medium.com/@joshblack/stateless-components-in-react-0-14-f9798f8b992d#.mwedhclq7
// https://github.com/ghengeveld/react-redux-styleguide
// ES6 react class stateless component
import React, {PropTypes} from 'react'
export default class Link extends React.Component {
@jurosh
jurosh / gist:6e487cdc4bb749d35826dbc08669ef78
Created June 7, 2016 09:03
React Redux example index.js components file
// Basic
import Button from 'components/button';
import Dropdown from 'components/dropdown';
export default {
Button,
Dropdown
};
@jurosh
jurosh / gist:087120a6053317704ddd2aa22f72b83b
Last active June 9, 2016 12:14
React stateless component
// --- comps ---
import React from '"react"';
const $component$ = () => (
<div>
$END$
</div>
);
export default $component$;
<html>
<head>
</head>
<body>
<div id="daco"></div>
<script>
console.log(daco);
</script>
<script>
@jurosh
jurosh / gist:e293fd022e83db0efd11832f5eb9a872
Last active September 27, 2016 18:57
Fibonacci sequence - javascript generator
function * fibon () {
let val1 = 0;
let val2 = 1;
let swap;
yield val1;
yield val2;
while (true) {
swap = val1 + val2;
val1 = val2;
val2 = swap;
@jurosh
jurosh / gist:b4dc6098c5a3fea461c938dce6378a73
Last active October 23, 2016 15:45
PHP Storm JavaScript Live Templates (Macros/Shortcuts)
@jurosh
jurosh / gist:7f984d421712909e44627c6e2c471fbe
Last active October 25, 2016 22:05
OPTIONS Preflight request | fetch
<html>
<body>
<script>
// Alternative fetch('http://biz.jurosh.local/packages/test.php', {headers: {'Content-Type': 'application/json'}})
fetch('http://biz.jurosh.local/packages/test.php', {method: 'PUT'})
.then(data => console.log('DATA!'));
// Accept is like: Here is my request and I would like (to Accept) this response format