Skip to content

Instantly share code, notes, and snippets.

View ankitsinghaniyaz's full-sized avatar
📺
Working Remote

Ankit Singhaniya ankitsinghaniyaz

📺
Working Remote
View GitHub Profile
Description:
Create Vue files corresponding to the Rails views
Example:
rails generate vue [namespace]/[controller]/action
This will create:
app/javascript/packs/[namespace]/[controller]/action.js
app/javascript/views/[namespace]/[controller]/action.vue
app/views/[namespace]/[controller]/action.html.erb
@ankitsinghaniyaz
ankitsinghaniyaz / packs-devise-registrations-new.js
Last active November 17, 2017 03:27
Vue with Rails - Pack File
import Vue from 'vue/dist/vue.esm';
// I am using elements UI for the UI components
// you can find them here, but you can do without them
// http://element.eleme.io/#/en-US
import ElementUI from 'element-ui';
// This the .vue file that we will create next
import DeviseRegistrationsNewView from 'views/devise/registrations/new.vue';
// It tells vue to register ElementUI, so that we can use it
<!-- this is the same id we reffered in the vue file -->
<!-- for consisteny, I also follow a convention in this -->
<!-- {folder-paths}-{action}-view -->
<div id="devise-registrations-new-view">
<!-- we talked about passing the validation error to vue -->
<!-- here is how easy it is to do this -->
<devise-registrations-new-view :errors="<%= resource.errors.full_messages %>">
</devise-registrations-new-view>
</div>
@ankitsinghaniyaz
ankitsinghaniyaz / bottom_toolbar.xml
Last active September 20, 2016 17:01
Google Plus Like Bottom Toolbar Layout
<?xml version="1.0" encoding="utf-8"?>
<!--This is the main frame layout in which I set hight, background and align it to the bottom-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
android:background="@color/colorPrimaryDark"
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/rectangle_background" />
</selector>
@ankitsinghaniyaz
ankitsinghaniyaz / boggle.py
Created May 26, 2016 18:29
Python code to solve boggle with crossover
"""Program to find count of words in a given grid
Rule : Do not reuse a cell
Rule : Do not cross over
Rule : can travel to adjecent 8 cells
input : 'word'
n x m
r a y x d
p e t r o
@ankitsinghaniyaz
ankitsinghaniyaz / index.html
Created February 12, 2016 02:45
my Chart1
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<script src='//code.jquery.com/jquery-1.9.1.min.js' type='text/javascript'></script>
<script src='//code.highcharts.com/highcharts.js' type='text/javascript'></script>
<script src='//code.highcharts.com/highcharts-more.js' type='text/javascript'></script>
<script src='//code.highcharts.com/modules/exporting.js' type='text/javascript'></script>
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='//cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.15-beta/nv.d3.min.css'>
<script src='//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js' type='text/javascript'></script>
<script src='//d3js.org/d3.v3.min.js' type='text/javascript'></script>
<script src='//cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.15-beta/nv.d3.min.js' type='text/javascript'></script>
<script src='//nvd3.org/assets/lib/fisheye.js' type='text/javascript'></script>