Skip to content

Instantly share code, notes, and snippets.

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

Charalampos Karypidis xabikos

🏠
Working from home
View GitHub Profile
@xabikos
xabikos / UserConfrmedFilterAttribute
Created May 6, 2014 17:54
Action fileter attribute that tiggers a redirect in a specific action method of controller when the user has not confirmed his email in an ASP.NET MVC 5 application
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public class UserConfirmedFilterAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
var userId = filterContext.HttpContext.User.Identity.GetUserId();
var userManager = filterContext.HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>();
if (!userManager.IsEmailConfirmedAsync(userId).Result)
{
@xabikos
xabikos / remote react bootstrap table example
Last active July 8, 2021 00:16
An example of a react bootstrap table that fetches the data asynchronously when navigating between pages and when changing the page size
import React, {Component} from 'react';
import {BootstrapTable, TableHeaderColumn} from 'react-bootstrap-table';
import _ from 'lodash';
const dataTable = _.range(1, 60).map(x => ({id: x, name: `Name ${x}`, surname: `Surname ${x}`}));
// Simulates the call to the server to get the data
const fakeDataFetcher = {
fetch(page, size) {
return new Promise((resolve, reject) => {
@xabikos
xabikos / gist:f096062d932c80d0adda
Created March 11, 2016 19:20
Delete all repositories for user through Octokit.net
static async Task Execute() {
var client = new GitHubClient(new ProductHeaderValue("my-cool-app"));
var basicAuth = new Credentials("githubusername", "githubpassword"); // NOTE: not real credentials
client.Credentials = basicAuth;
var repos = await client.Repository.GetAllForUser("githubusername");
var tasks = repos.Select(repo => client.Repository.Delete("githubusername", repo.Name));
Task.WaitAll(tasks.ToArray());
}