Skip to content

Instantly share code, notes, and snippets.

Fight for freedom

Jorge Izquierdo izqui

Fight for freedom
View GitHub Profile
GNSPS / ProxyFactory.sol
Last active Jul 24, 2020
Improved `delegatecall` proxy contract factory (Solidity) [v0.0.5]
View ProxyFactory.sol
* Shoutouts:
* Bytecode origin
* Modified version of Vitalik's
* Credits to Jorge Izquierdo (@izqui) for coming up with this design here:
* Credits to Stefan George (@Georgi87) for inspiration for many of the improvements from Gnosis Safe:
* This version has many improvements over the original @izqui's library like using REVERT instead of THROWing on failed calls.
* It also implements the awesome design pattern for initializing code as seen in Gnosis Safe Factory:
View -
function controlSelf() {
eval "defaults write org.eyebeam.SelfControl BlockDuration -int $1"
if [ "$2" = "nuke" ]; then
blacklist=" $extras"
eval "defaults write org.eyebeam.SelfControl HostBlacklist -array $blacklist"
defaults read org.eyebeam.SelfControl
sudo /Applications/ $(id -u $(whoami)) --install > /dev/null 2>&1
alexvandesande / ethernalsale.js
Last active Aug 17, 2017
This is a first draft at what could be a continuous token sale. I just wrote it and haven't tested it but it shows the proof of concept: tokens are continuously generated in any curve desired and sold for the highest bidder. Since there's a maximum token sale speed, this guarantees that sales can't end too quickly. Since the sale always starts f…
View ethernalsale.js
pragma solidity ^0.4.2;
contract ethernalSale {
struct order {
uint amount;
address buyer;
mapping (uint => order) orderBook;
mapping (address => uint) balanceOf;
View StaticCallProxy.sol
* It expects the input:
* 256 bit - address
* 256 bit - gas
* 256 bit - value
* n bit - calldata to be proxied
* And returns the output:
MaiaVictor /
Last active Apr 12, 2018
Make Ethereum massively scalable today with delayed computations

Make Ethereum massively scalable today with delayed computations

Suppose you're writing a contract which involves a huge amount of participants. As an example, think of an online, blockchain-based Trading-Card Game with tournaments. How would you program a playCard function? You might be thinking of something like this:

function playCard(uint player, uint card){
    else if (card == PROFESSOR_OAK){
        // shuffles the player's hand on his deck
View upgradeable.sol
* Base contract that all upgradeable contracts should use.
* Contracts implementing this interface are all called using delegatecall from
* a dispatcher. As a result, the _sizes and _dest variables are shared with the
* dispatcher contract, which allows the called contract to update these at will.
* _sizes is a map of function signatures to return value sizes. Due to EVM
* limitations, these need to be populated by the target contract, so the
* dispatcher knows how many bytes of data to return from called functions.
View FCXI.ino
Go ahead and use this for whatever you want. Credit would be nice, but I can't stop you and if this helps you in any way, I'm cool with it. Besides, I didn't even write a few chunks of this.
Author: Zweiter
Version: 1.1
nicklockwood / gist:21495c2015fd2dda56cf
Last active Aug 13, 2020
Thoughts on Swift 2 Errors
View gist:21495c2015fd2dda56cf

Thoughts on Swift 2 Errors

When Swift was first announced, I was gratified to see that one of the (few) philosophies that it shared with Objective-C was that exceptions should not be used for control flow, only for highlighting fatal programming errors at development time.

So it came as a surprise to me when Swift 2 brought (What appeared to be) traditional exception handling to the language.

Similarly surprised were the functional Swift programmers, who had put their faith in the Haskell-style approach to error handling, where every function returns an enum (or monad, if you like) containing either a valid result or an error. This seemed like a natural fit for Swift, so why did Apple instead opt for a solution originally designed for clumsy imperative languages?

I'm going to cover three things in this post:

kristopherjohnson / enumerateEnum.swift
Last active May 12, 2017
Helper functions for enumerating values of a Swift enum
View enumerateEnum.swift
// Protocol for a type that supports a fromRaw(Int) conversion
// (such as "enum Foo: Int { ... }")
protocol ConvertibleFromRawInt {
class func fromRaw(raw: Int) -> Self?
// Note: Tried to use Swift's standard RawRepresentable protocol rather
// than ConvertibleFromRawInt, but couldn't get it to compile.
// Don't know whether it is a Swift bug or something I was doing wrong.
tleen / gist:5109955
Created Mar 7, 2013
Format a Javascript Date to RFC-822 datetime using moment.js
View gist:5109955
var rfc822Date = moment(yourDate).format('ddd, DD MMM YYYY HH:mm:ss ZZ')
You can’t perform that action at this time.