Skip to content

Instantly share code, notes, and snippets.

@leviwilson
leviwilson / GsonDateFormatTest.java
Created April 26, 2012 03:47
Gson Date / Milliseconds
package com.leviwilson.test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertThat;
import java.util.Date;
import org.junit.Test;
// Needed in AndroidManifest:
<!-- Permission for using NFC hardware -->
<uses-permission android:name="android.permission.NFC"/>
<!-- Forcing device to have NFC hardware -->
<uses-feature android:name="android.hardware.nfc" android:required="true"/>
<!-- Registering app for receiving NFC's TAG_DISCOVERED intent -->
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
@DamonOehlman
DamonOehlman / README.md
Last active October 30, 2023 20:03
General WebRTC tips and tricks collated over time
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active July 2, 2024 00:02
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
wiredep = require( 'wiredep' )
path = require 'path'
# Karma configuration
module.exports = ( config ) ->
config.set
# enable / disable watching file and executing tests whenever any file changes
autoWatch: true
# base path, that will be used to resolve files relative to this file
@mbbx6spp
mbbx6spp / README.md
Last active July 5, 2024 11:11
Gerrit vs Github for code review and codebase management

Gerrit vs Github: for code review and codebase management

Sure, Github wins on the UI. Hands down. But, despite my initial annoyance with Gerrit when I first started using it almost a year ago, I am now a convert. Fully. Let me tell you why.

Note: This is an opinionated (on purpose) piece. I assume your preferences are like mine on certain ideas, such as:

  • Fast-forward submits to the target branch are better than allowing merge commits to the target branch. The reason I personally prefer this is that, even if a non-conflicting merge to the target branch is possible, the fact that the review/pull request is not up to date with the latest on the target branch means feature branch test suite runs in the CI pipeline reporting on the review/PR may not be accurate. Another minor point is that forced merge commits are annoying as fuck (opinion) and clutter up Git log histories unnecessarily and I prefer clean histories.
  • Atomic/related changes all in one commit is something worth striving for. Having your dev
@dlebech
dlebech / Gerrit comment formatting
Last active January 17, 2024 10:34
Comment formatting in Gerrit
The documentation for Gerrit when it comes to formatting comments is quite lacking. Here is short list created by trial and error and looking at the source code in:
./gerrit-gwtexpui/src/main/java/com/google/gwtexpui/safehtml/client/SafeHtml.java
Lists:
* List item 1
* List item 2
- List item 1
- List item 2
@traviskaufman
traviskaufman / logback_disable_in_unit_tests.md
Last active March 20, 2023 08:38
Logback: Disable all logging in unit tests

After scouring the internet and piece-mealing together the correct way to do this, here is a step-by-step, all-in-one-place guide to making logback STFU when running your unit tests.

Here's how to do it

Save the following as logback-test.xml under src/test/resources:

<configuration>
  <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
    <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
      <pattern>%msg%n</pattern>
@JiaLiPassion
JiaLiPassion / zone-blacklist.js
Created September 17, 2017 04:24
New Zone BlackList
// before load polyfill.js
<script>
// black list scroll event handler for addEventListener
Zone[Zone.__symbol__('BLACK_LISTED_EVENTS')] = ['scroll', 'mouseenter', 'mouseleave', 'mousemove', 'mouseover', 'mouseout', 'mousewheel'];
// black list scroll event handler for onProp
const targets = [window, Document.prototype, HTMLBodyElement.prototype, HTMLElement.prototype];
__Zone_ignore_on_properties = [];
targets.forEach(function(target) {
__Zone_ignore_on_properties.push({
@WebReflection
WebReflection / custom-elements-pattern.md
Last active May 17, 2024 23:30
Handy Custom Elements' Patterns

Handy Custom Elements' Patterns

Ricardo Gomez Angel Photo by Ricardo Gomez Angel on Unsplash

This gist is a collection of common patterns I've personally used here and there with Custom Elements.

These patterns are all basic suggestions that could be improved, enriched, readapted, accordingly with your needs.