Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Charalampos Karypidis xabikos

🏠
Working from home
View GitHub Profile
@xabikos
xabikos / gist:f096062d932c80d0adda
Created Mar 11, 2016
Delete all repositories for user through Octokit.net
View gist:f096062d932c80d0adda
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());
}
@xabikos
xabikos / remote react bootstrap table example
Last active Apr 20, 2021
An example of a react bootstrap table that fetches the data asynchronously when navigating between pages and when changing the page size
View remote react bootstrap table example
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 / UserConfrmedFilterAttribute
Created May 6, 2014
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
View UserConfrmedFilterAttribute
[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)
{