Skip to content

Instantly share code, notes, and snippets.

View arjndr's full-sized avatar

Akash Rajendra arjndr

View GitHub Profile
@arjndr
arjndr / cgo1.go
Created December 7, 2022 18:53 — forked from tejainece/cgo1.go
Examples of calling C code from Golang
package main
//#include<stdio.h>
//void inC() {
// printf("I am in C code now!\n");
//}
import "C"
import "fmt"
func main() {
@arjndr
arjndr / gist:b1487cd450dab186e9d574c08c4275e1
Created August 2, 2021 15:08 — forked from mobilinked/gist:9b6086b3760bcf1e5432932dad0813c0
SwiftUI - prevent auto dismiss the sheet by drag down
//
// Created by https://quickplan.app on 2020/11/8.
//
import SwiftUI
/// Control if allow to dismiss the sheet by the user actions
/// - Drag down on the sheet on iPhone and iPad
/// - Tap outside the sheet on iPad
/// No impact to dismiss programatically (by calling "presentationMode.wrappedValue.dismiss()")
@arjndr
arjndr / index.js
Created March 1, 2021 18:19 — forked from carloslfu/index.js
Make a P2P connection in 10 minutes
const crypto = require('crypto')
const Swarm = require('discovery-swarm')
const defaults = require('dat-swarm-defaults')
const getPort = require('get-port')
const readline = require('readline')
/**
* Here we will save our TCP peer connections
* using the peer id as key: { peer_id: TCP_Connection }
*/
<#
.SYNOPSIS
Uses Win32_Fan class to return information about fans in a system.
.DESCRIPTION
This script first defines some functions to decode various
WMI attributed from binary to text. Then the script calls
Get-WmiObject to retrieve fan details, then formats that
information (using the functions defined at the top of the script.
.NOTES
@arjndr
arjndr / three.js.shader.html
Created June 26, 2020 08:05 — forked from kylemcdonald/three.js.shader.html
Minimal three.js shader example.
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
margin: 0px;
overflow: hidden;
}
@arjndr
arjndr / cached-fetch.js
Created May 6, 2020 08:31 — forked from dslounge/cached-fetch.js
cache fetch in React Native
export const cachedFetch = url => {
const key = `@MySuperStore:${url}`;
return AsyncStorage.getItem(key)
.then(data => {
if (!data) {
return Promise.reject("no data found in async storage");
}
console.log("found data on disk");
return JSON.parse(data);
})
@arjndr
arjndr / eased-interval.js
Created February 20, 2020 07:12 — forked from mcordingley/eased-interval.js
setInterval, but with easing from one timer value to another
(function(root) {
'use strict';
// Mapping of returned interval handles to their current timeout handles
var intervals = {},
easedIntervalCounter = 0;
var isNumeric = function(candidate) {
return (!isNaN(parseFloat(candidate)) && isFinite(candidate));
},
@arjndr
arjndr / filterArray.js
Created February 19, 2020 17:36 — forked from jherax/arrayFilterFactory.1.ts
Filters an array of objects with multiple match-criteria.
/**
* Filters an array of objects by custom predicates.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria
* @return {Array}
*/
function filterArray(array, filters) {
const filterKeys = Object.keys(filters);
return array.filter(item => {
@arjndr
arjndr / gist:59463e743b66f90db8b028c9129e7de4
Created October 27, 2018 17:30 — forked from bradwestfall/gist:f5a010e96fb0c4d18556
Pull Instagram Images via JavaScript
alert('hello ' + document.location.href);