Skip to content

Instantly share code, notes, and snippets.

View sygn's full-sized avatar

Željko Tadić sygn

  • Zagreb, Croatia
View GitHub Profile
# 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
@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);
}
@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 / 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 / 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 / laenderinfos.sql
Created November 23, 2017 20:29 — forked from fiee/laenderinfos.sql
table of information about all countries of the world (German names)
CREATE TABLE adressen.land
(
isocode_2 character(2) not null, -- ISO 3166 ALPHA-2
isocode_3 character(3) not null, -- ISO 3166 ALPHA-3
name character varying not null, -- deutscher Name des Landes (international besser via ISO-Code ankoppeln!) // German name of the country
vorwahl integer default null, -- internationale Vorwahl // international phone code
null_bei_vorwahl boolean default FALSE, -- muss man die Null der Ortsvorwahl auch nach der internationalen Vorwahl wählen? // must one dial zero between international and local phone code?
vorwahl_lokal boolean default FALSE, -- muss man vor Ort die Vorwahl wählen? // must one dial the local phone code also locally?
tld character varying default NULL, -- Top Level Domain
kfz character varying default NULL, -- KFZ-Kennzeichen // car code
### Keybase proof
I hereby claim:
* I am sygn on github.
* I am ztadic91 (https://keybase.io/ztadic91) on keybase.
* I have a public key ASD0Wy_GZx1WjTmx23vkRwKNBT48DBAMOZzwgtPXaS_5_Qo
To claim this, I am signing this object:
@sygn
sygn / index.js
Created October 24, 2019 21:31
View network requests in chrome developer tools for react-native
// To see all the requests in the chrome Dev tools in the network tab.
XMLHttpRequest = GLOBAL.originalXMLHttpRequest ?
GLOBAL.originalXMLHttpRequest :
GLOBAL.XMLHttpRequest;
@sygn
sygn / fade-in.scss
Created January 8, 2020 14:57 — forked from sajhd/fade-in.scss
Fade In Animation Mixin
/* Fade In Animation */
@keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}
/* Firefox < 16 */
@-moz-keyframes fadein {
from { opacity: 0; }
@sygn
sygn / index.jsx
Created January 21, 2020 12:25
Debug re-render cause in React
componentDidUpdate(prevProps, prevState) {
Object.entries(this.props).forEach(([key, val]) =>
prevProps[key] !== val && console.log(`Prop '${key}' changed`)
);
if (this.state) {
Object.entries(this.state).forEach(([key, val]) =>
prevState[key] !== val && console.log(`State '${key}' changed`)
);
}
}