Skip to content

Instantly share code, notes, and snippets.

View tabishiqbal's full-sized avatar

Tabish Iqbal tabishiqbal

  • Toronto, Ontario
View GitHub Profile
@tabishiqbal
tabishiqbal / routes.rb
Last active March 15, 2019 18:35
Clean up routes file
class ActionDispatch::Routing::Mapper
def draw(routes_names)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_names}.rb")))
end
end
Rails.application.routes.draw do
draw :users
draw :settings
...
import Vue from 'vue'
// Autoload all Vue components
const files = require.context('./', true, /\.vue$/i)
files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key)))
// Register the Vue component
const root = document.getElementById('app')
window.vue = new Vue({
render: h => h(
@tabishiqbal
tabishiqbal / async-await.js
Created February 10, 2019 04:56 — forked from wesbos/async-await.js
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@tabishiqbal
tabishiqbal / homebrew-permissions-issue.md
Created January 10, 2019 00:42 — forked from irazasyed/homebrew-permissions-issue.md
Homebrew: Permissions Denied Issue Fix (OS X / macOS)

Homebrew Permissions Denied Issues Solution

sudo chown -R $(whoami) $(brew --prefix)/*

@tabishiqbal
tabishiqbal / ruby-zsh-install.sh
Created January 5, 2019 22:24 — forked from Koroeskohr/ruby-zsh-install.sh
Install Ruby with ZSH
cd
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(rbenv init -)"' >> ~/.zshrc
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
sudo apt-get install -y libssl-dev libreadline-dev zlib1g-dev
rbenv install -v 2.3.1
rbenv global 2.3.1
@tabishiqbal
tabishiqbal / add new tool.vue
Created October 23, 2018 20:19
adding new tool get in vue component
<template>
<div class="w-4/5">
<form class="form" enctype="multipart/form-data" method="post" v-on:submit.prevent="submitForm">
<div class="bg-white py-5 px-6 mb-6 rounded shadow">
<div class="pb-8">
<div class="text-base font-medium">General Information</div>
</div>
<div class="flex flex-wrap -mx-3 mb-6">
<div class="w-full md:w-1/2 px-3 mb-6 md:mb-0">
@tabishiqbal
tabishiqbal / uppy-vue-example
Created September 20, 2018 23:37 — forked from pooot/uppy-vue-example
Very basic vuejs usage of uppy
<template>
<div :id="uppyId">
<div class="ThumbnailContainer" v-if="collection === 'thumbnail'">
<button id="open-thumbnail-modal" class="button">Select file</button>
</div>
<div class="DashboardContainer" v-else></div>
</div>
</template>
@tabishiqbal
tabishiqbal / _vue-rails.md
Created September 14, 2018 14:20 — forked from przbadu/_vue-rails.md
Vue js and Rails integration

Setup Rails and Vuejs

  1. Generate new rails app using --webpack flag
rails new myApp --webpack=vue

Note:

  1. You can use --webpack=angular for angular application and --webpack=react for react.
@tabishiqbal
tabishiqbal / application.html.erb
Created February 15, 2018 19:25 — forked from mebezac/application.html.erb
Rails Ajax Flash Messages
<div id="main" role="main">
<div class="container">
<div class="row">
<div class="span12" id="top-div"> <!--! added "top-div" id to help with ajax -->
<%= render 'layouts/messages' %>
<%= yield %>
</div>
</div>
<footer>
</footer>
class WelcomeController < ApplicationController
skip_before_filter :authenticate_user!
layout 'welcome'
def index
end
def pricing
end