Skip to content

Instantly share code, notes, and snippets.

@nicobytes
nicobytes / deploy-gh.sh
Last active August 3, 2020 20:14
Deploy gh-pages ionic pwa
#!/bin/bash
git branch -D gh-pages
git push origin --delete gh-pages
git checkout -b gh-pages
ionic build --prod
find . -type d ! -path './www*' ! -path './.git*' ! -path '.' | xargs rm -rf
rm -r *.*
mv www/* .
rm -rf www
git add .
@keesey
keesey / levenshtein.ts
Last active February 14, 2024 10:59
Levenshtein distance implemented in TypeScript
export function levenshtein(a: string, b: string): number
{
const an = a ? a.length : 0;
const bn = b ? b.length : 0;
if (an === 0)
{
return bn;
}
if (bn === 0)
{
@chrishuan9
chrishuan9 / gist:3192782
Created July 28, 2012 10:14
50/50 Layout Split with RelativeLayout in Android by using an invisible View and centering it
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<View android:id="@+id/strut"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_centerHorizontal="true"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"