Skip to content

Instantly share code, notes, and snippets.

View sygn's full-sized avatar

Željko Tadić sygn

  • Zagreb, Croatia
View GitHub Profile
@sygn
sygn / AccountController.FacebookCallback1.cs
Created November 17, 2017 20:30 — forked from ntotten/AccountController.FacebookCallback1.cs
Facebook Authentication with the Facebook C# SDK and ASP.NET MVC 4
public ActionResult FacebookCallback(string code)
{
var fb = new FacebookClient();
dynamic result = fb.Post("oauth/access_token", new
{
client_id = "your_app_id_here",
client_secret = "your_app_secret_here",
redirect_uri = RedirectUri.AbsoluteUri,
code = code
});
@sygn
sygn / DbInitializer.cs
Created October 7, 2017 10:43 — forked from mombrea/DbInitializer.cs
EF Core and ASP.NET Core Identity Seed Data
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using System.Linq;
namespace My.App.Data
{
public class DbInitializer : IDbInitializer
{
private readonly ApplicationDbContext _context;
private readonly UserManager<ApplicationUser> _userManager;
@sygn
sygn / README.md
Created April 22, 2017 21:06 — forked from fnichol/README.md
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

@sygn
sygn / array.js
Created March 6, 2017 13:06
array iteration with item variable
var items = [1, 2, 3, 4, 5];
for (var item, i = 0; item = items[i]; i++) {
console.log(item);
}
# Linux
git config --global credential.helper cache
git config --global credential.helper "cache --timeout=3600"
# Windows
git config --global credential.helper wincred
# OSX
https://help.github.com/articles/caching-your-github-password-in-git/#platform-mac