Skip to content

Instantly share code, notes, and snippets.

View SleeplessByte's full-sized avatar
💎
💎 💎 💎

Derk-Jan Karrenbeld SleeplessByte

💎
💎 💎 💎
View GitHub Profile
@SleeplessByte
SleeplessByte / .gitignore
Created September 17, 2013 00:58
Comprehensive Android git ignore
#################
## Eclipse
#################
*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
@SleeplessByte
SleeplessByte / .gitattributes
Last active February 3, 2021 14:57
.gitattributes that will make development on Windows Great Again
# Handle line endings automatically for files detected as text
# and leave all files detected as binary untouched.
* text=auto
# Force the following filetypes to have unix eols, so Windows does not break them
*.* text eol=lf
# Windows forced line-endings
/.idea/* text eol=crlf
@SleeplessByte
SleeplessByte / silly.js
Created February 3, 2014 18:40
Javascript is silly
"J"+(([]===[])+/-/)[1]+/\[[^1]+\]/[([]+![])[1<<1<<1]+(/|/[(1+{})[1+11>>>1]+[[]+{}][+!1][1]+([]+1/[])[1<<1>>1]+([1<1]+[])[1+11>>>1+1]+[[!!1]+1][+[]][1-1]+([]+!!/!/)[1|1]+(/1/[1]+[])[!1%1]+(-{}+{})[-1+1e1-1]+(1+[!!1])[1]+([]+1+{})[1<<1]+[!!/!!/+[]][+[]][1&1]]+/=/)[1e1+(1<<1|1)+(([]+/-/[(!!1+[])[1>>1]+(!!1+[])[1<<1^1]+(!1+[])[1|1<<1]+(!!1+[])[1^1]])[1^1]==+!1)]+(!![]+{})[1|1<<1]+[1+{}+1][!1+!1][(11>>1)+1]](([]+/-/[(!!1+[])[1>>1]+(!!1+[])[1<<1^1]+(!1+[])[1|1<<1]+(!!1+[])[1^1]]))[1&.1][11>>>1]+(([]===[])+/-/)[1]+([1<1]+[])[1+11>>>1+1]+(1+{})[1+11>>>1]+[!!/!!/+[]][+[]][1&1]+/\[[^1]+\]/[([]+![])[1<<1<<1]+(/|/[(1+{})[1+11>>>1]+[[]+{}][+!1][1]+([]+1/[])[1<<1>>1]+([1<1]+[])[1+11>>>1+1]+[[!!1]+1][+[]][1-1]+([]+!!/!/)[1|1]+(/1/[1]+[])[!1%1]+(-{}+{})[-1+1e1-1]+(1+[!!1])[1]+([]+1+{})[1<<1]+[!!/!!/+[]][+[]][1&1]]+/=/)[1e1+(1<<1|1)+(([]+/-/[(!!1+[])[1>>1]+(!!1+[])[1<<1^1]+(!1+[])[1|1<<1]+(!!1+[])[1^1]])[1^1]==+!1)]+(!![]+{})[1|1<<1]+[1+{}+1][!1+!1][(11>>1)+1]](([]+/-/[(!!1+[])[1>>1]+(!!1+[])[1<<1^1]+(!1+[])[1|1<<1]+(!!1+[])[
@SleeplessByte
SleeplessByte / rfc4122-uuid.js
Created April 29, 2014 19:12
RFC4122 compliant UUID in Javascript (by broofa)
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});
@SleeplessByte
SleeplessByte / detect.java
Created November 5, 2014 22:08
Credit Card Detection
public static CardType fromCardNumber( String cardNumber ) {
if ( cardNumber == null )
return CardType.Null;
if ( cardNumber.matches( "^4[0-9]*$" ) )
return CardType.Visa;
if ( cardNumber.matches( "^5[1-5][0-9]*$" ) )
return CardType.MasterCard;
if ( cardNumber.matches( "^3[47][0-9]*$" ))
return CardType.Amex;
if ( cardNumber.matches( "^6(?:011|5)[0-9]*$" ))
Verifying that +sleeplessbyte is my openname (Bitcoin username). https://onename.io/sleeplessbyte
@SleeplessByte
SleeplessByte / view_action.html
Last active August 29, 2015 14:13
View Action Gmail
<div itemscope itemtype="http://schema.org/EmailMessage">
<meta itemprop="description" content="DESCRIPTION"/>
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://evergive.com/redirect_to/posts/organization/xxx/group/yyy"/>
<meta itemprop="name" content="Show community"/>
</div>
<div itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Evergive"/>
<link itemprop="url" href="https://evergive.com"/>
</div>
@SleeplessByte
SleeplessByte / confirm_action.html
Last active August 29, 2015 14:13
Confirm (one-click) Action Gmail
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ConfirmAction">
<meta itemprop="name" content="Approve XXX"/>
<div itemprop="handler" itemscope itemtype="http://schema.org/HttpActionHandler">
<link itemprop="url" href="https://SOMEURLTOAPPROVE"/>
</div>
</div>
<meta itemprop="description" content="Approval request for John's $10.13 expense for office supplies OR SOMETHING ELSE"/>
</div>
@SleeplessByte
SleeplessByte / save_action.html
Created January 20, 2015 20:07
Save (on-click) Action Gmail
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/SaveAction">
<meta itemprop="name" content="Save Offer"/>
<div itemprop="handler" itemscope itemtype="http://schema.org/HttpActionHandler">
<link itemprop="url" href="https://offers-everywhere.com/save?offerId=xyz789"/>
</div>
</div>
<meta itemprop="description" content="$5 meal at Joe's Diner"/>
</div>
@SleeplessByte
SleeplessByte / order_extended.html
Created January 20, 2015 20:08
Order / Receipt Gmail
<div itemscope itemtype="http://schema.org/Order">
<div itemprop="merchant" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Amazon.com"/>
</div>
<meta itemprop="orderNumber" content="123-4567890-1234567"/>
<meta itemprop="priceCurrency" content="USD"/>
<meta itemprop="price" content="539.00"/>
<div itemprop="acceptedOffer" itemscope itemtype="http://schema.org/Offer">
<div itemprop="itemOffered" itemscope itemtype="http://schema.org/Product">
<meta itemprop="name" content="Samsung Chromebook"/>