Skip to content

Instantly share code, notes, and snippets.

View abhilashak's full-sized avatar
🎯
Focusing

Abhilash A K abhilashak

🎯
Focusing
View GitHub Profile
@abhilashak
abhilashak / MySQL_5-7_macOS.md
Created May 15, 2019 06:19 — forked from robhrt7/MySQL_5-7_macOS.md
Install MySQL 5.7 on macOS using Homebrew

This is a fork of original gist https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).

Install MySQL 5.7 on macOS

This procedure explains how to install MySQL using Homebrew on macOS (Sierra 10.12 and up)

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.
@abhilashak
abhilashak / default
Created February 4, 2019 12:30 — forked from dtomasi/default
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}
@abhilashak
abhilashak / nested_content_snippet.rb
Last active October 28, 2023 21:06 — forked from bunnymatic/nested_content_snippet.rb
Nested content tags in rails 5 view helpers
# because i can never remember exactly how and when to use concat
# when building content in helpers
def nested_content
content_tag 'div' do
concat(content_tag 'span', 'span block')
concat(tag 'br')
concat(link_to 'root link', root_path)
concat(tag 'br')
concat(link_to('#') do
concat(content_tag 'h2', 'Head \'em off')
@abhilashak
abhilashak / application.html.erb
Created May 26, 2018 11:20 — forked from fjahr/application.html.erb
Displaying Rails 5 flash messages with Twitter Bootstrap 4 (last tested on Alpha-v6). Updated version of https://gist.github.com/suryart/7418454
// layout file
<body>
<div class="container">
<%= flash_messages %>
<%= yield %>
</div><!-- /container -->
</body>
@abhilashak
abhilashak / gist:c39c23024ef7a882cddcd893cff15b0d
Created May 25, 2018 09:53 — forked from kindohm/gist:4643056
converts .wav files to base64 encoded text
//crude and incomplete but it works
var fs = require('fs');
var Buffer = require('buffer').Buffer;
var constants = require('constants');
var size = 0;
var encoded = '';
var fileName = '';
var wavFileName = '';
var base64FileName = '';
@abhilashak
abhilashak / redux_setup.md
Created May 3, 2018 10:16 — forked from kiok46/redux_setup.md
Redux, store, actions and reducers setup along with explanation.

Redux Setup

Implementation of redux inside any react.js or react-native application,

  • we will create an instance of the redux store.
  • We are going to create a provider tag from react redux library
  • Then render that provider tag passing in the store as a prop, then any child component to this provider tag will have access to this store through the context system inside of react.
  • import { Provider } from ‘react-redux’; // In main.js
  • to create a store create one in a separate folder.
@abhilashak
abhilashak / web-fonts-asset-pipeline.md
Created April 14, 2018 06:51 — forked from anotheruiguy/web-fonts-asset-pipeline.md
Custom Web Fonts and the Rails Asset Pipeline

Web fonts are pretty much all the rage. Using a CDN for font libraries, like TypeKit or Google Fonts, will be a great solution for many projects. For others, this is not an option. Especially when you are creating a custom icon library for your project.

Rails and the asset pipeline are great tools, but Rails has yet to get caught up in the custom web font craze.

As with all things Rails, there is more then one way to skin this cat. There is the recommended way, and then there are the other ways.

The recommended way

Here I will show how to update your Rails project so that you can use the asset pipeline appropriately and resource your files using the common Rails convention.

@abhilashak
abhilashak / gist:3077e3e6d03713620c30eb5b9baef2df
Created April 14, 2018 05:55 — forked from tagrudev/gist:4276467
Add custom fonts to your rails application
##
Lets say we have YoloFont.otf
1. We add it to vendor/assets/fonts/ folder
2. Me personaly creates a file named fonts.css.scss in app/assets/stylesheets
In it I have
@font-face{
font-family: 'YoloFont';
@abhilashak
abhilashak / gist:8f3f3da07588c472aee43b50bf46ab14
Created August 28, 2017 10:04 — forked from mattconnolly/gist:4158961
RSpec basic authentication helper module for request and controller specs
module AuthHelper
def http_login
user = 'username'
pw = 'password'
request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(user,pw)
end
end
module AuthRequestHelper
#