Skip to content

Instantly share code, notes, and snippets.

@vishnoor
vishnoor / GitHub-Forking.md
Created December 11, 2021 22:43 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

package com.example.controllers.dashboard;
import org.springframework.security.jwt.Jwt;
import org.springframework.security.jwt.JwtHelper;
import org.springframework.security.jwt.crypto.sign.MacSigner;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@vishnoor
vishnoor / WebAPIConfig.cs
Created November 23, 2017 11:24
Line needed to enable CORS in Web API 5.0
public static class WebApiConfig {
public static void Register(HttpConfiguration config) {
// Web API configuration and services
// Configure Web API to use only bearer token authentication.
config.Formatters.XmlFormatter.SupportedMediaTypes.Add(new System.Net.Http.Headers.MediaTypeHeaderValue("multipart/form-data"); config.SuppressDefaultHostAuthentication(); config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType));
// Web API routes
config.MapHttpAttributeRoutes();
@vishnoor
vishnoor / AESCrypt.java
Created January 30, 2017 13:43
This is the Java/Grails equivalent that can decode , encode requests sent encrypted using https://github.com/scottyab/AESCrypt-Android. Be sure to use the adv methods for weak IV vector issues
package pbcs;
import java.io.UnsupportedEncodingException;
import java.security.GeneralSecurityException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
@vishnoor
vishnoor / gist:2d64e727a23d6b146761
Created November 23, 2015 13:19 — forked from pdwetz/gist:5368441
Outputs a POCO for a given MySql table. Based on http://stackoverflow.com/a/13918084/21865 with mild formatting changes and additional types added.
select 'replacewithtablename' into @table;
select 'replacewithdatabasename' into @schema;
select concat('public class ',@table,'{')
union
select concat('public ',tps.dest,' ',column_name,'{get;set;}')
from information_schema.columns c
join (
select 'char' as orign ,'string' as dest union all