Skip to content

Instantly share code, notes, and snippets.

@DavidIbrahim
DavidIbrahim / DashedBorder.kt
Last active May 14, 2024 15:13
dashedBorder modifier for android compose
import androidx.compose.foundation.BorderStroke
/*
* Copyright 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@gildor
gildor / BorderModifier.kt
Last active September 7, 2023 07:01
Example of border modifier for Jetpack Compose
import androidx.compose.runtime.Stable
import androidx.compose.ui.Modifier
import androidx.compose.ui.drawBehind
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Path
import androidx.compose.ui.graphics.drawscope.DrawScope
import androidx.compose.ui.unit.Dp
/**
* Border definition can be extended to provide border style or [androidx.compose.ui.graphics.Brush]
@jeromeetienne
jeromeetienne / peerjs-receiver.html
Last active November 6, 2022 11:00
peerjs example - standalone - one webpage sending data to another
<script src="http://cdn.peerjs.com/0.3/peer.min.js"></script>
<script type="text/javascript">
// https://github.com/peers/peerjs
// go here to get your own key
var peerjsPeer = new Peer({key: 'xxxYOURKEYGOESHERExxxx'});
peerjsPeer.on('open', function() {
console.log('My peerjsPeer ID is: ', peerjsPeer.id);
});
@bellbind
bellbind / main.js
Last active April 27, 2024 04:12
[electron] Tray launcher example
"use strict";
// [run the app]
// $ npm install electron
// $ ./node_modules/.bin/electron .
const {app, nativeImage, Tray, Menu, BrowserWindow} = require("electron");
let top = {}; // prevent gc to keep windows
@VassilisPallas
VassilisPallas / FileInformation.java
Created May 17, 2016 22:55
get file information from URI
import android.annotation.TargetApi;
import android.content.ContentUris;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
import android.provider.OpenableColumns;
@james2doyle
james2doyle / simple-json-reponse.php
Last active March 7, 2024 06:02
A simple JSON response function for PHP. Used in various PhileCMS plugins.
<?php
function json_response($code = 200, $message = null)
{
// clear the old headers
header_remove();
// set the actual code
http_response_code($code);
// set the header to make sure cache is forced
header("Cache-Control: no-transform,public,max-age=300,s-maxage=900");