Skip to content

Instantly share code, notes, and snippets.

View ismailbayram's full-sized avatar
🏠
Working from home

İsmail Bayram ismailbayram

🏠
Working from home
View GitHub Profile
@yasirkula
yasirkula / HorizontalCamera.cs
Last active October 24, 2024 04:13
A script to fix the horizontal FOV/orthographic size of a camera to a specified value in Unity
using UnityEngine;
[ExecuteInEditMode]
[RequireComponent( typeof( Camera ) )]
public class HorizontalCamera : MonoBehaviour
{
private Camera m_camera;
private float lastAspect;
#pragma warning disable 0649
@enricofoltran
enricofoltran / main.go
Last active October 3, 2024 14:08
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@mpolinowski
mpolinowski / gist:be444c52280598752a408b9e9b3de123
Created October 26, 2017 12:28
React — Dynamic Component Names with JSX
import React from 'react'
import Layout from '../components/layout'
import Products from '../components/_products'
import IndoorCameras from '../components/_indoorCameras'
import OutdoorCameras from '../components/_outdoorCameras'
class InstarProducts extends Component {
components = {
products: Products,
@guillaumepiot
guillaumepiot / test_image_upload.py
Last active January 22, 2024 19:19
Django Rest Framework - Image/File upload test
import os
import io
from PIL import Image
from django.core.urlresolvers import reverse
from django.conf import settings
from rest_framework import status
from rest_framework.test import APITestCase
@gunjanpatel
gunjanpatel / revert-a-commit.md
Last active November 11, 2024 17:49
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@MCheli
MCheli / dishRouter.js
Created June 13, 2016 21:42
Minimal Node JS Server with Express Routers as Modules
var express = require('express');
var bodyParser = require('body-parser');
var dishRouter = express.Router();
dishRouter.use(bodyParser.json());
dishRouter.route('/')
.all(function (req, res, next) {
res.writeHead(200, {'Content-Type': 'text/plain'});
@PurpleBooth
PurpleBooth / README-Template.md
Last active November 17, 2024 18:07
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@ftvs
ftvs / CameraShake.cs
Last active September 26, 2024 07:16
Simple camera shake effect for Unity3d, written in C#. Attach to your camera GameObject. To shake the camera, set shakeDuration to the number of seconds it should shake for. It will start shaking if it is enabled.
using UnityEngine;
using System.Collections;
public class CameraShake : MonoBehaviour
{
// Transform of the camera to shake. Grabs the gameObject's transform
// if null.
public Transform camTransform;
// How long the object should shake for.
@ecarter
ecarter / mapOrder.js
Created December 2, 2011 15:40
Order an array of objects based on another array order
/**
* Sort array of objects based on another array
*/
function mapOrder (array, order, key) {
array.sort( function (a, b) {
var A = a[key], B = b[key];