Skip to content

Instantly share code, notes, and snippets.

View onlyoneaman's full-sized avatar
👀
Focussed

Aman (e/acc) onlyoneaman

👀
Focussed
View GitHub Profile

How to Make a Pull Request ?

Every Expert was once a beginner, so if you are facing difficulties or don't know how to make pull request. Don't worry, we are here to help you.

Prerequisites

  1. You should have an account on GitHub.
  2. You should have git installed on your computer.

Step 1 :

Fork the repository by clicking on FORK button.

@onlyoneaman
onlyoneaman / Ruby cors
Last active June 2, 2020 12:15
Handling CORS in Rails app
module Userapi
class Application < Rails::Application
#...
#Rails 3/4
config.middleware.insert_before 0, "Rack::Cors" do
allow do
origins '*'
resource '*', :headers => :any, :methods => [:get, :post, :options]
import './App.css';
import { changeColor } from './main';
function App() {
return (
<div className="App">
<header className="App-header">
<button onClick={changeColor}>
Change color
</button>
/*global chrome*/
export async function changeColor() {
chrome.storage.sync.set({color: "#3aa757"}, ()=>{});
await chrome.tabs.query({active: true, currentWindow: true},
(
r => {
chrome.tabs.executeScript(r[0].id , {file: 'scripts/changeBgColor.js'}, function() {
if(chrome.runtime.lastError) {
{
"short_name": "BgColor Change",
"name": "Change background color",
"version": "1.0.0",
"manifest_version": 2,
"permissions": [
"storage",
"tabs",
"activeTab",
"http://*/*",
class HooksController < ApplicationController
def handle_webhook
payload = request.body.read
sig_header = request.headers["X-Hub-Signature"]
sig_header.slice! "sha1="
app_secret = Figaro.env.FB_APP_SECRET
sign = get_sha_sign(payload, app_secret)
if sign != sig_header
raise BaseError::InvalidRequest.new("Invalid Signature")
@onlyoneaman
onlyoneaman / jsconfig.json
Created August 21, 2021 19:59
Config for ReactJS project to use absolute imports.
{
"compilerOptions": {
"baseUrl": "src"
},
"include": ["src"]
}
@onlyoneaman
onlyoneaman / profile.tsx
Created August 21, 2021 20:15
Profile.tsx file without absolute imports
import ContentWrapper from '../../../../Components/ContentWrapper'
const SampleComponent = () => {
return (
<ContentWrapper
style={{
width: '100%',
padding: '20px 10px',
marginBottom: '10px'
@onlyoneaman
onlyoneaman / profile.tsx
Created August 21, 2021 20:16
Sample file with absolute configuration
import ContentWrapper from 'Components/ContentWrapper'
const SampleComponent = () => {
return (
<ContentWrapper
style={{
width: '100%',
padding: '20px 10px',
marginBottom: '10px'
@onlyoneaman
onlyoneaman / tsconfig.json
Created August 21, 2021 20:23
tsconfig.json for Absolute Imports
{
"compilerOptions": {
...,
"baseUrl": "src"
},
"include": [
"src"
]
}