Skip to content

Instantly share code, notes, and snippets.

View arielm's full-sized avatar

Ariel Malka arielm

View GitHub Profile
@arielm
arielm / CustomCollectionViewCell.swift
Last active March 23, 2022 11:29
Bug: Random "vertical jumps" while scrolling up in UICollectionViewController
import UIKit
class CustomCollectionViewCell: UICollectionViewCell {
private lazy var label: UILabel = {
let view = UILabel()
view.translatesAutoresizingMaskIntoConstraints = false
view.font = UIFont.boldSystemFont(ofSize: 48)
view.textColor = .yellow
view.textAlignment = .center
return view
@arielm
arielm / Shader.frag
Last active December 2, 2021 04:51
Testing OpenGL 2.1 / WebGL1 lighting
#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D u_sampler;
uniform float u_shininess;
varying vec3 v_normal;
varying vec4 v_color;
varying vec2 v_coord;
@arielm
arielm / Shader.frag
Last active November 25, 2021 12:54
Testing OpenGL 2.1 / WebGL1 instancing with lighting
#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D u_sampler;
uniform float u_shininess;
varying vec3 v_normal;
varying vec4 v_color;
varying vec2 v_coord;
@arielm
arielm / test_async_wget2.cpp
Created November 22, 2021 12:20
Test to load a file asynchronously with emscripten
#include <emscripten/emscripten.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
int pending_count = 0;
void onload(unsigned handle, void* arg, void* data, unsigned length) {
const char *text = (const char*)data;
printf("RECEIVED:\n[%s]\n[%i]\n", text, length);
@arielm
arielm / webgl_instancing_test.c
Created November 19, 2021 10:20
Testing OpenGL instancing for emscripten / WebGL1
#include <stdio.h>
#include <stdlib.h>
#include <emscripten/emscripten.h>
#include <emscripten/html5.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
int main()
{
EmscriptenWebGLContextAttributes attr;
@arielm
arielm / gendef-download
Created November 18, 2021 08:29
mxe log: make cc fails with "Download failed or wrong checksum of package gendef!"
--2021-11-18 10:09:48-- https://downloads.sourceforge.net/project/mingw-w64/mingw-w64/mingw-w64-release/mingw-w64-v9.0.0.tar.bz2
Resolving downloads.sourceforge.net (downloads.sourceforge.net)... 204.68.111.105
Connecting to downloads.sourceforge.net (downloads.sourceforge.net)|204.68.111.105|:443... connected.
ERROR: The certificate of 'downloads.sourceforge.net' is not trusted.
ERROR: The certificate of 'downloads.sourceforge.net' has expired.
MXE Warning! Downloading gendef from backup.
--2021-11-18 10:09:50-- https://mirror.mxe.cc/pkg/mingw-w64-v9.0.0.tar.bz2_1929b94b402f5ff4d7d37a9fe88daa9cc55515a6134805c104d1794ae22a4181
Resolving mirror.mxe.cc (mirror.mxe.cc)... 104.131.71.203
Connecting to mirror.mxe.cc (mirror.mxe.cc)|104.131.71.203|:443... connected.
ERROR: The certificate of 'mirror.mxe.cc' is not trusted.
exec > /tmp/${PROJECT_NAME}_archive.log 2>&1
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
if [ "true" == ${ALREADYINVOKED:-false} ]
then
echo "RECURSION: Detected, stopping"
else
export ALREADYINVOKED="true"
@arielm
arielm / Google URL Shortener API
Created February 22, 2018 10:44 — forked from hayageek/Google URL Shortener API
Google URL Shortener API Javascript Example
<html>
<head>
</head>
<script type="text/javascript">
function makeShort()
{
var longUrl=document.getElementById("longurl").value;
var request = gapi.client.urlshortener.url.insert({
'resource': {
'longUrl': longUrl
@arielm
arielm / Triangle.java
Created September 11, 2016 15:10
Solution (81%) to Triangle problem on Codility (https://codility.com/programmers/task/triangle)
/*
* CORRECTNESS: 100%
* PERFORMANCE: 50%
*
* FOR A 100% SOLUTION, SEE:
* https://codesays.com/2014/solution-to-triangle-by-codility/
*/
class Solution
{
@arielm
arielm / Distinct.java
Last active September 11, 2016 14:59
Solution (100%) to Distinct problem on Codility (https://codility.com/programmers/task/distinct/)
/*
* EASIEST TEST OF ALL SO FAR...
*/
import java.util.*;
class Solution
{
public int solution(int[] A)
{