Skip to content

Instantly share code, notes, and snippets.

View calderaro's full-sized avatar

Angel Calderaro calderaro

View GitHub Profile
@calderaro
calderaro / loading.html
Created January 20, 2023 15:09
widget loading animation
<!DOCTYPE html>
<html>
<body>
<div class="container">
<img
src="https://firebasestorage.googleapis.com/v0/b/tpf-apps.appspot.com/o/online-auth%2FOA%20loader.svg?alt=media&token=5027c2ec-4ca5-447c-b451-6708eae32072"
class="loader"
/>
</div>
@calderaro
calderaro / zoneiso
Created August 12, 2022 16:08
Moment zoned iso string
console.log(moment().toISOString(true));
// sample output: 2022-04-06T16:26:36.758+03:00
@calderaro
calderaro / gist:1612e3b5f241d341d008575ed9ebe76f
Created July 14, 2022 21:22
Obtain bundle identifier programmatically
ios swift 3+:
```
let bundleID = Bundle.main.bundleIdentifier
```
ios objective-c:
NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
@calderaro
calderaro / example.m
Created October 18, 2021 12:42
Parsing JSON in Objective C
// json s string for NSDictionary object
NSString *s = @"{\"temperature\": -260.65, \"humidity\": 54.05, \"time\": \"2016-03-14T09:46:48Z\", \"egg\": 1, \"id\": 6950, \"no2\": 0.0}";
// comment above and uncomment below line, json s string for NSArray object
// NSString *s = @"[{\"ID\":{\"Content\":268,\"type\":\"text\"},\"ContractTemplateID\":{\"Content\":65,\"type\":\"text\"}}]";
NSData *jsonData = [s dataUsingEncoding:NSUTF8StringEncoding];
NSError *error;
// Note that JSONObjectWithData will return either an NSDictionary or an NSArray, depending whether your JSON string represents an a dictionary or an array.
id jsonObject = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error];
@calderaro
calderaro / home.tsx
Created September 6, 2021 00:27
Conekta Card Tokenization React Native
import React from 'react';
import {Button, Text} from 'react-native';
import {StackNavigationProp} from '@react-navigation/stack';
import {WebView} from 'react-native-webview';
import {RootStackParamList} from '../../navigation/RootStack';
import {SafeAreaView} from 'react-native-safe-area-context';
type BootNavigationProps = StackNavigationProp<RootStackParamList, 'Boot'>;
interface Props {
// C++ bit . save it in an example.cpp file
#include "emscripten.h"
extern "C" {
inline const char* cstr(const std::string& message) {
char * cstr = new char [message.length()+1];
std::strcpy (cstr, message.c_str());
return cstr;
}
EMSCRIPTEN_KEEPALIVE
const char* getAMessage() {
@calderaro
calderaro / gif_test.cpp
Created May 6, 2021 16:42 — forked from suzumura-ss/gif_test.cpp
gif-lib basic example.
#include <iostream>
#include <sstream>
#include <string>
#include <string.h>
#include <gif_lib.h>
bool gif_write(const char* fileName)
{
int error;
@calderaro
calderaro / dockercommands.md
Created April 23, 2021 16:37
docker commands

Delete all containers

docker rm -f $(docker ps -a -q)

Delete all volumes

docker volume rm $(docker volume ls -q)

@calderaro
calderaro / ruby-lang-config
Created April 22, 2021 16:19
this exports are required for ruby to work
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
const reduxSwitchcase = (cases, key) =>
key in cases ? cases[key] : state => state;
export default reduxSwitchcase;