Skip to content

Instantly share code, notes, and snippets.

@rocknrollskyoveryou
rocknrollskyoveryou / gist:6dda39abf8bfd8fa479e
Created December 25, 2015 13:49
Vertical align <span> inside <div>
#html
<div>
<span>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</span>
</div>
#scss
div{
height: 25px;
line-height: 25px;
text-align: center;
@gatlingxyz
gatlingxyz / gist:52fb21eb92181716b0ce
Created July 11, 2014 23:49
Unofficial Base WatchFace Activity
import android.app.Activity;
import android.content.Context;
import android.hardware.display.DisplayManager;
import android.os.Bundle;
import android.view.Display;
/**
* A base activity for watch faces that have callbacks for the various screen states (dim, awake, and off)
* as well as a callback for when the watch face is removed.
* <p/>
@slightfoot
slightfoot / gist:6330866
Last active December 12, 2022 22:31
Android Tone Generator
// Usage:
// AudioTrack tone = generateTone(440, 250);
// tone.play();
//
private AudioTrack generateTone(double freqHz, int durationMs)
{
int count = (int)(44100.0 * 2.0 * (durationMs / 1000.0)) & ~1;
short[] samples = new short[count];
for(int i = 0; i < count; i += 2){
short sample = (short)(Math.sin(2 * Math.PI * i / (44100.0 / freqHz)) * 0x7FFF);
@aras-p
aras-p / preprocessor_fun.h
Last active April 12, 2024 17:24
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,