Skip to content

Instantly share code, notes, and snippets.

View AshikNesin's full-sized avatar

Ashik Nesin AshikNesin

View GitHub Profile
@AshikNesin
AshikNesin / rails-skip.md
Created September 10, 2015 11:28
Rails generator controller without tests, assets & helpers

Configuring application.rb

To turn off without having to add options:

# application.rb
config.generators.assets = false
config.generators.helper = false

While Generating Controller

@AshikNesin
AshikNesin / github-url.md
Last active February 4, 2024 17:42
Regular Expression to check GitHub Profile URL
/^(https?:\/\/)?(www\.)?github\.com\/[a-zA-Z0-9_]{1,25}$/igm

@AshikNesin
AshikNesin / base64-form-data.js
Last active December 19, 2023 06:08
Base64 image to multipart/form-data
const base64 = 'data:image/png;base64,....' // Place your base64 url here.
fetch(base64)
.then(res => res.blob())
.then(blob => {
const fd = new FormData();
const file = new File([blob], "filename.jpeg");
fd.append('image', file)
// Let's upload the file
// Don't set contentType manually → https://github.com/github/fetch/issues/505#issuecomment-293064470
@AshikNesin
AshikNesin / react-file-upload.js
Created February 2, 2017 06:46
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
}
@AshikNesin
AshikNesin / export.js
Created April 20, 2022 19:19 — forked from katoen/export.js
Export Wallet by BudgetBakers records to JSON
// Source for Jake Archibald's idb https://github.com/jakearchibald/idb/blob/v3.0.2/build/idb.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = global || self, factory(global.idb = {}));
}(this, function (exports) { 'use strict';
function toArray(arr) {
return Array.prototype.slice.call(arr);
}
@AshikNesin
AshikNesin / rails-new-directory.md
Created October 5, 2015 11:17
[Rails] Create Rails App in current directory

rails new .

<html>
<head>
<title>Site Title</title>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="author" content="">
<meta name="keywords" content="">
<meta property="og:title" content="" />
<meta property="og:type" content="" />
@AshikNesin
AshikNesin / date.utils.js
Created July 28, 2016 10:52
[JS] Implicit Convert HH:MM:SS to Date Object
function toDateWithOutTimeZone(date) {
let tempTime = date.split(":");
let dt = new Date();
dt.setHours(tempTime[0]);
dt.setMinutes(tempTime[1]);
dt.setSeconds(tempTime[2]);
return dt;
}
@AshikNesin
AshikNesin / center-button.html
Created August 20, 2015 09:47
Center a button in bootstrap
<div class="text-center">
<input type="button" class="btn btn-ghost btn-ghost-bordered center-block" value="GO BACK" style="width:160px;">
</div>
@AshikNesin
AshikNesin / setup-lamp-ubuntu.sh
Last active April 2, 2019 03:01
Setup LAMP Stack Ubuntu 16
# Install Apache
sudo apt-get update
sudo apt-get install apache2 -y
# Install PHP7
sudo apt-get -y install php7.0 libapache2-mod-php7.0
sudo apt-get install php7.0-cli php7.0-common libapache2-mod-php7.0 php7.0 php7.0-mysql php7.0-fpm -y
# Other packages which might be useful