Skip to content

Instantly share code, notes, and snippets.

View lnked's full-sized avatar
🧠
I may be slow to respond.

Edik Bulikyan lnked

🧠
I may be slow to respond.
View GitHub Profile
@lnked
lnked / react-file-upload.js
Created March 19, 2018 01:11 — forked from AshikNesin/react-file-upload.js
Simple React File Upload
import React from 'react'
import axios, { post } from 'axios';
class SimpleReactFileUpload extends React.Component {
constructor(props) {
super(props);
this.state ={
file:null
}
@lnked
lnked / AsyncComponent.tsx
Created February 25, 2018 01:28 — forked from crucialfelix/AsyncComponent.tsx
TypeScript port of react-loadable
/**
* A port, cleanup and simplification of https://github.com/thejameskyle/react-loadable
* MIT License Copyright 2017 Chris Sattinger
*/
import React from "react";
export function Loading({ loading = true }) {
return loading
? <i className="fa fa-spinner fa-spin" aria-hidden="true" />
: null;
@lnked
lnked / MacOSXSierra:Brew+Apache+Mysql+PHPSwitcher+DNSMasq+SSL.md
Created January 29, 2018 00:28 — forked from andrewstobbe/MacOSXSierra:Brew+Apache+Mysql+PHPSwitcher+DNSMasq+SSL.md
Mac OSX Sierra : Brew Apache + Mysql + PHP Switcher + DNSMasq + SSL

Mac OSX Sierra : Brew Apache + Mysql + PHP Switcher + DNSMasq + SSL 👍

Things I had to do using Homebrew to get my local web dev environment back up and running after migration to OSX Sierra + Xcode 8.1.

Note: I used brew reinstall because I had already installed most of this previously under Yosemite. Probably better ways to do this, but this is what worked for me.

brew doctor

brew tap homebrew/dupes
brew tap homebrew/versions
@lnked
lnked / default
Created January 25, 2018 15:26 — forked from dtomasi/default
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}
@lnked
lnked / serviceworker.js
Created October 22, 2017 00:52 — forked from kosamari/serviceworker.js
cache index.html using Service Worker
/*
* CHALLANGE:
* Cache `index.html` file using service worker.
*
* This bit of code is included in <script> tag of index.html
* if (navigator.serviceWorker) {
* navigator.serviceWorker.register('serviceworker.js', {scope: '/'})
* }
*
*/
@lnked
lnked / gist:7e2e5d016c40679efea930de70dd9a8d
Created May 17, 2017 15:48 — forked from realmyst/gist:1262561
Склонение числительных в javascript
function declOfNum(number, titles) {
cases = [2, 0, 1, 1, 1, 2];
return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ];
}
use:
declOfNum(count, ['найдена', 'найдено', 'найдены']);
@lnked
lnked / gist:5fd440af19bf67b8616bcfb96640088d
Created April 28, 2017 20:26 — forked from MrRoyce/gist:280063164a5f744cb0ec3ecc36be84a7
webpack.config.js to debug problem with Module not found: Error: Cannot resolve module 'babel-runtime'
/**
* @Author: Royce
* @Date: 2016-06-12T10:54:44-04:00
* @Email: rharding@tonight.com
* @Project: Tonight
* @Last modified by: royce
* @Last modified time: 2016-09-23T19:58:59-04:00
* @License: © 2016 Tonight LLC All Rights Reserved
*/
@lnked
lnked / svgfixer.js
Created February 7, 2017 22:48 — forked from leonderijke/svgfixer.js
Fixes references to inline SVG elements when the <base> tag is in use.
/**
* SVG Fixer
*
* Fixes references to inline SVG elements when the <base> tag is in use.
* Firefox won't display SVG icons referenced with
* `<svg><use xlink:href="#id-of-icon-def"></use></svg>` when the <base> tag is on the page.
*
* More info:
* - http://stackoverflow.com/a/18265336/796152
* - http://www.w3.org/TR/SVG/linking.html
@lnked
lnked / main.yml
Created January 27, 2017 22:48 — forked from Stubbs/main.yml
Ansible Playbook to install PHP7
- name: Install Packages Needed To Compile PHP 7
apt: pkg={{ item }} state=latest
with_items:
- git
- autoconf
- bison
- libxml2-dev
- libbz2-dev
- libmcrypt-dev
- libcurl4-openssl-dev
@lnked
lnked / force_new_tab.php
Created June 3, 2016 01:24 — forked from jakebellacera/force_new_tab.php
Force PDF links to open in a new tab in PHP.
$new_text = preg_replace(
'/((<a (?=.*\.pdf)(?!.*target="_blank").*?)>)/',
'$2 target="_blank">',
$old_text
);