Skip to content

Instantly share code, notes, and snippets.

View albodelu's full-sized avatar

Al B. albodelu

View GitHub Profile
@pchiusano
pchiusano / GADTs.scala
Created November 16, 2011 04:30
GADT support in Scala
/** GADTs in Scala and their limitations */
/** Background: what is an algebraic data type (ADT) ?
* ADT: (possibly) recursive datatype with sums and products
* In scala - a trait with case classes (case class is product, subtyping is sum)
*/
/** Motivation: untyped embedded DSL doesn't prevent nonsensical expressions */
sealed trait Expr {
def apply(other: Expr) = Ap(this, other)
@jungilhan
jungilhan / AndroidManifest.xml
Created June 3, 2013 13:00
ACTION_MY_PACKAGE_REPLACED 사용하기
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mypackagereplaced"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
@broady
broady / 1MarkerAnimation.java
Last active August 19, 2024 12:30
Animating Markers
/* Copyright 2013 Google Inc.
Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0.html */
package com.example.latlnginterpolation;
import android.animation.ObjectAnimator;
import android.animation.TypeEvaluator;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.os.Build;
@scy
scy / delete-from-repo.md
Created September 20, 2013 11:54
How to delete a file from a Git repository, but not other users' working copies

How to delete a file from a Git repository, but not other users' working copies

Suppose you have, by mistake, added your IDE's project folder (you know, these .idea folders with all kinds of local paths and configuration data and settings in it) to the Git repository of your project. (We're talking about a whole folder here, but the same rules apply to individual files as well.)

Of course, you only realize that two days after the fact and have already pushed it, and your colleagues have already pulled it. They use the same IDE as you do, so whenever they change a setting or fix paths, they can either

  • commit that, causing nasty merge conflicts for you and others or
  • ignore the changes and carry around a modified file until the end of time without ever committing it.

Why .gitignore won't help

@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active November 19, 2024 03:22
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
git rm -rf .idea; git commit -m "delete .idea"; git push;
@timrijckaert
timrijckaert / AndroidManifest.xml
Last active May 2, 2020 19:32
Test rule that disables animations and softkeyboard before any test. Easy access function to control demo modus on API 23 and up devices
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="be.rijckaert.tim.disableanimations">
<!-- Place this permission in your debug folder -->
<uses-permission android:name="android.permission.SET_ANIMATION_SCALE"/>
</manifest>
@Atternatt
Atternatt / DataCaptionInfo.kt
Created March 24, 2017 12:26
Delegating SharedPreferences into parameters
data class DataCaptionInfo(private val context: Context) {
var name: String by Delegate.prefParam(context,"NAME", "")
var lastName: String by Delegate.prefParam(context, "LAST_NAME", "")
var email : String by Delegate.prefParam(context, "EMAIL", "")
var referalCode: String by Delegate.prefParam(context, "REFERAL_ID", "")
@Atternatt
Atternatt / MonadUsage.kt
Last active September 21, 2017 04:55
monads
sum4(4) //return 8
div2(4) //return 2
listOf(3,4,6,8,10)
.map(sum4)
.map(div2)
//[3, 4, 5, 6, 7]
fun hello(name: String, textDecorator: () -> String): String {
return "hello $name ${textDecorator()}"