Skip to content

Instantly share code, notes, and snippets.

View enzo-santos's full-sized avatar
🦧

Enzo Santos enzo-santos

🦧
View GitHub Profile
@lummie
lummie / custom_time.go
Last active August 14, 2024 14:14
Golang custom date / time formats when marshalling to JSON
// CustomTime provides an example of how to declare a new time Type with a custom formatter.
// Note that time.Time methods are not available, if needed you can add and cast like the String method does
// Otherwise, only use in the json struct at marshal/unmarshal time.
type CustomTime time.Time
const ctLayout = "2006-01-02 15:04:05 Z07:00"
// UnmarshalJSON Parses the json string in the custom format
func (ct *CustomTime) UnmarshalJSON(b []byte) (err error) {
@pmav99
pmav99 / linspace.py
Created April 28, 2015 14:05
Pure python linspace / logspace implementation
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: Panagiotis Mavrogiorgos
# email: gmail, pmav99
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import