Skip to content

Instantly share code, notes, and snippets.

View rossmartin's full-sized avatar

Ross Martin rossmartin

View GitHub Profile
@MarcoEidinger
MarcoEidinger / TableWithCodeTipsAndExamples.md
Last active July 12, 2024 02:48
Master GitHub markdown tables with code blocks

Master GitHub markdown tables with code blocks

  1. Use HTML tags to define the table to get the best layout result
  2. Use either backticks (```) or the HTML pre element with attribute lang
  3. Keep a blank line before and after a code block for correct formatting and syntax highlighting

Good

Example: nice looking table to show HTTP Responses

@FelDev
FelDev / appStoreConnectAPIFromNode.js
Last active March 25, 2024 10:15
Boilerplate to authenticate to the App Store Connect API from Node.js
console.log("🏃 appStoreConnectAPIFromNode.js running 🏃‍")
const fs = require('fs');
const jwt = require('jsonwebtoken'); // npm i jsonwebtoken
// You get privateKey, apiKeyId and issuerId from your Apple App Store Connect account
const privateKey = fs.readFileSync("./AuthKey_123456789Z.p8") // this is the file you can only download once and should treat like a real, very precious key.
const apiKeyId = "123456789Z"
const issuerId = "12345678-CLAP-FORR-THIS-GIBBERISHLOLz"
let now = Math.round((new Date()).getTime() / 1000); // Notice the /1000
let nowPlus20 = now + 1199 // 1200 === 20 minutes
@don
don / index.js
Created January 16, 2018 02:08
Break up large ArrayBuffer before writing to BLE characteristic
// Mock BLE so you can run example from nodejs
const ble = {
write: function(device_id, service, characteristic, buffer, success, failure) {
// log to console instead of writing
console.log('>>', new Uint8Array(buffer));
// always call success callback
success();
}
}
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active July 19, 2024 18:06
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@aggarwalankush
aggarwalankush / Sql.ts
Last active December 19, 2019 12:33
Ionic 2 storage
import {Injectable} from "@angular/core";
import {Platform} from "ionic-angular";
const DB_NAME: string = '__mydbname';
const win: any = window;
@Injectable()
export class Sql {
private _dbPromise: Promise<any>;
import {Sql} from "../providers/Sql";
export class ExamplePage {
constructor(private sql: Sql) {
//sql.query(...);
//...
}
}
@jarretmoses
jarretmoses / React Native Clear Cache
Last active July 17, 2024 15:14
Clearing the Cache of your React Native Project
RN < 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
RN >= 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
RN >= 0.63 - watchman watch-del-all && rm -rf node_modules && npm install && rm -rf /tmp/metro-* && npm run start --reset-cache
npm >= 5 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache
Windows - del %appdata%\Temp\react-native-* & cd android & gradlew clean & cd .. & del node_modules/ & npm cache clean --force & npm install & npm start -- --reset-cache
@paulirish
paulirish / what-forces-layout.md
Last active July 23, 2024 15:12
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@mlynch
mlynch / ionRadio.js
Last active October 13, 2022 15:07
ionRadio fix for iOS 9 bugs
/**
* ionRadioFix - fixes a bug in iOS 9 UIWebView that breaks the tilde selector in CSS. To
* use this fix, include it after your Ionic bundle JS.
*
* Note: due to Angular directive override limitations, you'll need to change any reference
* to <ion-radio> to <ion-radio-fix> to apply this patched radio button.
*
* Also, make sure to add the new CSS from the second part of this gist.
*/
angular.module('ionic').directive('ionRadioFix', function() {
/**
* ================== angular-ios9-uiwebview.patch.js v1.1.1 ==================
*
* This patch works around iOS9 UIWebView regression that causes infinite digest
* errors in Angular.
*
* The patch can be applied to Angular 1.2.0 – 1.4.5. Newer versions of Angular
* have the workaround baked in.
*
* To apply this patch load/bundle this file with your application and add a