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
<!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>
@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>
@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 / 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 / nginx_proxy.config
Created April 20, 2017 17:15
Elastic Beankstalk Nginx configuration to supports /assets and /packs
# This is to enable WS support. Credits: # https://gist.github.com/Bubelbub/0a942a0d51a3d329897d
# THIS WORKS! for running the example 5.0.0.beta1 chat app on a single instance Elastic beanstalk AWS instance
files:
"/etc/nginx/conf.d/websockets.conf" :
content: |
upstream backend {
server unix:///var/run/puma/my_app.sock;
}
@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
<script>
// .vue files typically have 3 section
// 1.template - markup, 2.script - js, 3.style - css
// we are importing the csrf component it has two hidden input fields
// for csrf token and utf encoding
// creating a component helps us reuse it in multiple forms
import CSRF from 'components/shared/csrf.vue';
export default {
<!-- 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>
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