Skip to content

Instantly share code, notes, and snippets.

@jpudysz
jpudysz / live-activity-intents.js
Created February 1, 2024 17:48
Add target to any file in Xcode with Expo config plugin
const { withXcodeProject } = require('@expo/config-plugins')
const findFileReferenceByName = (xcodeProject, fileName) => {
const fileReferences = xcodeProject.hash.project.objects['PBXFileReference']
return Object.fromEntries(
Object
.entries(fileReferences)
.filter(([key, value]) => value.name === `"${fileName}"`)
)
@thenbrent
thenbrent / bs-debugging-helpers.php
Last active September 9, 2019 06:43
A few handy functions for debugging PHP script execution in WordPress/WooCommerce.
<?php
/**
* Plugin Name: Brent's Debugging Helpers
* Plugin URI:
* Description: bs_backtrace() etc.
* Version: 8.13.21
* Author:
* Author URI:
*/
@skellock
skellock / gist:b8513985e56b03a59963188803b4184e
Created April 26, 2016 13:23
Sends a shake command to each attach android device.
$ANDROID_HOME/platform-tools/adb devices | grep '\\t' | awk '{print $1}' | sed 's/\\s//g' | xargs -I {} $ANDROID_HOME/platform-tools/adb -s {} shell input keyevent 82
@polbins
polbins / README.md
Last active September 6, 2019 11:08
Android Response Caching using Retrofit 1.9 + OkHttp 2.2

Android REST Controller with Cache-Control

Android REST Controller with Simple Cache Control Headers using Retrofit 1.9.0 + OkHttp 2.2.0

@daniellevass
daniellevass / android_material_design_colours.xml
Last active March 26, 2024 15:48
Android Material Design Colours
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>
@shakalaca
shakalaca / build.gradle
Last active December 30, 2022 08:34
move & rename APK files
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.6'
}
}
task wrapper(type: Wrapper) {
@mtttmpl
mtttmpl / relative-time.php
Created September 29, 2012 16:51
Get Relative Time in PHP (e.g. '1 hour ago', 'yesterday', 'tomorrow', 'in 2 weeks')
<?php
function time2str($ts) {
if(!ctype_digit($ts)) {
$ts = strtotime($ts);
}
$diff = time() - $ts;
if($diff == 0) {
return 'now';
} elseif($diff > 0) {
$day_diff = floor($diff / 86400);