Skip to content

Instantly share code, notes, and snippets.

Working on better world

Amir Irani iraniamir

Working on better world
Block or report user

Report or block iraniamir

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
iraniamir / main.go
Created May 8, 2019
IPv4 to Mongo ObjectID
View main.go
package main
import (
iraniamir / main.go
Last active May 1, 2019
Instagram, show summary email address
View main.go
package main
import (
func main() {
iraniamir / form-validation.jsx
Created Oct 28, 2018
React html5 form validation
View form-validation.jsx
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { EMLINK } from 'constants';
export default class FormValidation extends Component {
static propTypes = {
children: PropTypes.node,
submit: PropTypes.func.isRequired
iraniamir / server.js
Created Sep 16, 2018
View server.js
const express = require('express');
const axios = require('axios');
const cacheAdapter = require('axios-cache-adapter');
const app = express()
const port = 3210
const fetchCache = cacheAdapter.setup({
cache: {
maxAge: 15 * 60 * 1000
iraniamir / index.html
Created Aug 21, 2018
Chunk upload file
View index.html
<meta charset="utf-8">
<title>Fanap Drive Upload</title>
View data.js
"hasError": false,
"referenceNumber": "207899",
"errorCode": 0,
"count": 0,
"ott": "ad341b80f845cd2e",
"result": {
"id": 132,
"ownerId": 0,
View gist:542efea7984bbcb3ccc2315f1d36f46e
DirectoryIndex /application/index.html
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /application/index.html [L]
<IfModule mod_expires.c>
ExpiresActive Off
iraniamir / gist:58460372cf2e4c54fc7679a614b114cb
Created Jan 29, 2018
Block all countries except IRAN for linux servers in iptables with geoip
View gist:58460372cf2e4c54fc7679a614b114cb
iptables -A INPUT -m geoip --src-cc A1 -j DROP &&
iptables -A INPUT -m geoip --src-cc A2 -j DROP &&
iptables -A INPUT -m geoip --src-cc AD -j DROP &&
iptables -A INPUT -m geoip --src-cc AE -j DROP &&
iptables -A INPUT -m geoip --src-cc AF -j DROP &&
iptables -A INPUT -m geoip --src-cc AG -j DROP &&
iptables -A INPUT -m geoip --src-cc AI -j DROP &&
iptables -A INPUT -m geoip --src-cc AL -j DROP &&
iptables -A INPUT -m geoip --src-cc AM -j DROP &&
iptables -A INPUT -m geoip --src-cc AO -j DROP &&
iraniamir / preview-form.jsx
Created Jan 28, 2018
Mithril Bootstrap Forms
View preview-form.jsx
import m from "mithril";
module.exports = (options, ...elements) => {
return (
<form {...options.attrs} class="form needs-validation">
{ => {
iraniamir / preview-pagination.jsx
Created Jan 28, 2018
Mithril Bootstrap Pagination
View preview-pagination.jsx
import m from "mithril";
export default {
go(number) {
this.node.state[this.state] = number;
eachPage(number, active = false) {
You can’t perform that action at this time.