Skip to content

Instantly share code, notes, and snippets.

View arbel03's full-sized avatar
💭
main_v2_final_final_version-rev5-01_19-finished(1).py

arbel03

💭
main_v2_final_final_version-rev5-01_19-finished(1).py
View GitHub Profile
@arbel03
arbel03 / parse_demangled.py
Last active May 16, 2021 12:49
Parse demangled names
import re
from collections import namedtuple
Class = namedtuple('Class', ['namespace', 'name', 'template_arguments'])
def parse_recursive(string):
template_start = string.find('<')
template_end = string.rfind('>')
@arbel03
arbel03 / groups.py
Created September 2, 2018 10:50
Create random groups from a list easily
import random
names = ["arbel", "liav", "yuval", "nevo", "matan", "nitzan", "gilad", "or"]
group_count = 2
groups = { group: [] for group in range(group_count) }
group_index = 0
while (len(names) != 0):
random.shuffle(names)
group_index = group_index%group_count
groups[group_index].append(names.pop())
@arbel03
arbel03 / callback.js
Created August 16, 2018 07:48
Returns a new function that runs the original one with the provided arguments. The resulted callback doesn't require any arguments.
// Run `callback` on any function and provide arguments.
// Returns - a callback that takes no arguments and run the original
// function using the arguments provided in the call to `.callback()`
Function.prototype.callback = function() {
var args = arguments;
var thisFunc = this;
return function() {
return thisFunc.apply(thisFunc, Array.prototype.slice.call(args));
};
};
@arbel03
arbel03 / AppRater.swift
Last active March 30, 2020 18:42
A customizable Swift class that triggers a dialog for asking the user to rate the app.
//
// AppRater.swift
// EasyGraphCalculator_iOS
//
// Created by arbel03 on 23/03/2016.
// Copyright © 2016 arbel03. All rights reserved.
//
import UIKit
class AppRater {
@arbel03
arbel03 / BasicAuthentication.swift
Last active March 30, 2020 18:42
Swift extension of a URLRequest that add Basic Authentication to the authorization header of a HTTP request as per rfc7617: https://tools.ietf.org/html/rfc7617
//
// BasicAuthenticationExtension.swift
// ToCheckIn
//
// Created by arbel03 on 25/08/2016.
// Copyright © 2016 arbel03. All rights reserved.
//
import Foundation