Skip to content

Instantly share code, notes, and snippets.

Avatar
👀
Focussed

Aman Kumar onlyoneaman

👀
Focussed
View GitHub Profile
View CameraController.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraController : MonoBehaviour
{
public GameObject player;
private Vector3 offset;
@onlyoneaman
onlyoneaman / PlayerExtension.cs
Created Nov 8, 2021
Roll Ball Player Extension Script
View PlayerExtension.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerController : MonoBehaviour
{
public float speed = 0;
private Rigidbody rb;
View eslint-config.json
{
"eslintConfig": {
"extends": ["react-app", "airbnb"],
"settings": {
"import/resolver": {
"node": {
"paths": ["src"],
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
}
@onlyoneaman
onlyoneaman / tsconfig.json
Created Aug 21, 2021
tsconfig.json for Absolute Imports
View tsconfig.json
{
"compilerOptions": {
...,
"baseUrl": "src"
},
"include": [
"src"
]
}
@onlyoneaman
onlyoneaman / profile.tsx
Created Aug 21, 2021
Sample file with absolute configuration
View profile.tsx
import ContentWrapper from 'Components/ContentWrapper'
const SampleComponent = () => {
return (
<ContentWrapper
style={{
width: '100%',
padding: '20px 10px',
marginBottom: '10px'
@onlyoneaman
onlyoneaman / profile.tsx
Created Aug 21, 2021
Profile.tsx file without absolute imports
View profile.tsx
import ContentWrapper from '../../../../Components/ContentWrapper'
const SampleComponent = () => {
return (
<ContentWrapper
style={{
width: '100%',
padding: '20px 10px',
marginBottom: '10px'
@onlyoneaman
onlyoneaman / jsconfig.json
Created Aug 21, 2021
Config for ReactJS project to use absolute imports.
View jsconfig.json
{
"compilerOptions": {
"baseUrl": "src"
},
"include": ["src"]
}
View rails_fb_validate_payload.rb
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")
View extension-main.js
/*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) {
View gist:cfc5e21f6b10ea8e99e08b140ddcd0e0
import './App.css';
import { changeColor } from './main';
function App() {
return (
<div className="App">
<header className="App-header">
<button onClick={changeColor}>
Change color
</button>