Skip to content

Instantly share code, notes, and snippets.

module.exports = {
entry: ['./src/index.tsx'],
devtool: 'cheap-module-source-map',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js'
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json']
},
yarn add @babel/core @babel/preset-env @babel/preset-react @babel/preset-typescript babel-loader typescript prettier -D
import React from 'react';
import AutoComplete from 'react-otocomplete';
import ReactDOM from 'react-dom';
let Index = React.createClass({
getInitialState() {
return {
value: ''
};
},
@diki
diki / react-otocomplete-simple.js
Last active January 26, 2016 15:08
higher order react autocomplete
import React from 'react';
import AutoComplete from 'react-otocomplete';
import ReactDOM from 'react-dom';
let Index = React.createClass({
getInitialState() {
return {
value: ''
};
},
@diki
diki / country-codes
Created April 27, 2015 11:20
country codes is JSON array
[{},{"code":"AD","name":"Andorra"},{"code":"AE","name":"United Arab Emirates"},{"code":"AF","name":"Afghanistan"},{"code":"AG","name":"Antigua and Barbuda"},{"code":"AI","name":"Anguilla"},{"code":"AL","name":"Albania"},{"code":"AM","name":"Armenia"},{"code":"AO","name":"Angola"},{"code":"AQ","name":"Antarctica"},{"code":"AR","name":"Argentina"},{"code":"AS","name":"American Samoa"},{"code":"AT","name":"Austria"},{"code":"AU","name":"Australia"},{"code":"AW","name":"Aruba"},{"code":"AX","name":"Åland Islands"},{"code":"AZ","name":"Azerbaijan"},{"code":"BA","name":"Bosnia and Herzegovina"},{"code":"BB","name":"Barbados"},{"code":"BD","name":"Bangladesh"},{"code":"BE","name":"Belgium"},{"code":"BF","name":"Burkina Faso"},{"code":"BG","name":"Bulgaria"},{"code":"BH","name":"Bahrain"},{"code":"BI","name":"Burundi"},{"code":"BJ","name":"Benin"},{"code":"BL","name":"Saint Barthélemy"},{"code":"BM","name":"Bermuda"},{"code":"BN","name":"Brunei Darussalam"},{"code":"BO","name":"Bolivia, Plurinational State of"},{"cod
function getWindowDimensions(){
var viewportwidth;
var viewportheight;
// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
if (typeof window.innerWidth != 'undefined')
{
viewportwidth = window.innerWidth,
viewportheight = window.innerHeight;
}
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
// get window element of given iframe object
// works in all browsers
function getIframeWindow(iframe_object) {
var doc;
if (iframe_object.contentWindow) {
return iframe_object.contentWindow;
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title></title>
<script src="js/json2.js"></script>
<script type="text/javascript" src="http://js.jotform.com/JotFormCustomWidget.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="//assets.transloadit.com/js/jquery.transloadit2-v2-latest.js"></script>
JF.createFormQuestion("32742366921860",
{
"type": "control_head",
"text": "Created form questions shit",
"order": "3",
"name":"clickTo",
},
function success(){
console.log("question created");
@diki
diki / optiomized-http.conf
Created March 3, 2013 16:09
sample apache configuration file where optimization like expire header, keepalice and caching implemented
#
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
#
# Do NOT simply read the instructions in here without understanding