Skip to content

Instantly share code, notes, and snippets.

View meeDamian's full-sized avatar
👨‍💻
Lightning Networking

Damian Mee meeDamian

👨‍💻
Lightning Networking
View GitHub Profile
http = require 'http'
https = require 'https'
url = require 'url'
querystring = require 'querystring'
class Downloader
constructor: (@url, @method="GET", headers, @params) ->
@headers =
'User-Agent': '*Coin-Monitor'
'Content-Type': "application/x-www-form-urlencoded"
Cryptsy = ->
if Cryptsy::_singletonInstance
return Cryptsy::_singletonInstance
Cryptsy::_singletonInstance = @
@orders = []
app.service 'Session', ->
@create: (@sessionId, @userId) ->
@destroy: ->
@id = @userId = null
@
angular.module("app.directives", []).directive('pwdMatch', function() {
return {
link: function(scope, elm, attrs) {
var checker;
checker = function() {
return elm.val() === scope.$eval(attrs.pwdMatch);
};
return scope.$watch(checker, function(n) {
return console.log("passwords" + (!n ? " do not" : "") + " match");
});
0100000001aca7f3b45654c230e0886a57fb988c3044ef5e8f7f39726d305c61d5e818903c00000000
fd5d010048304502200187af928e9d155c4b1ac9c1c9118153239aba76774f775d7c1f9c3e106ff33c0221008822b0f658edec22274d0b6ae9de10ebf2da06b1bbdaaba4e50eb078f39e3d78014
730440220795f0f4f5941a77ae032ecb9e33753788d7eb5cb0c78d805575d6b00a1d9bfed02203e1f4ad9332d1416ae01e27038e945bc9db59c732728a383a6f1ed2fb99da7a4014
cc952410491bba2510912a5bd37da1fb5b1673010e43d2c6d812c514e91bfa9f2eb129e1c183329db55bd868e209aac2fbc02cb33d98fe74bf23f0c235d6126b1d8334f864104865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac09ef122b1a986818a7cb624532f062c1d1f8722084861c5c3291ccffef4ec687441048d2455d2403e08708fc1f556002f1b6cd83f992d085097f9974ab08a28838f07896fbab08f39495e15fa6fad6edbfb1e754e35fa1c7844c41f322a1863d4621353ae
ffffffff0140420f00000000001976a914ae56b4db13554d321c402db3961187aed1bbed5b88ac00000000
protected boolean isValidFragment(String fragmentName) {
if (getApplicationInfo().targetSdkVersion >= android.os.Build.VERSION_CODES.KITKAT) {
throw new RuntimeException(
"Subclasses of PreferenceActivity must override isValidFragment(String)"
+ " to verify that the Fragment class is valid! " + this.getClass().getName()
+ " has not checked if fragment " + fragmentName + " is valid.");
} else {
return true;
}
}
package com.example.testSingleton;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
public class ActivityA extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
@meeDamian
meeDamian / MyTextView.java
Last active December 25, 2015 16:39
Just a handy trick to handle lack of `android:textAllCaps="true"` on devices prior to ICS
public class MyTextView extends TextView {
private boolean allCaps = false;
public MyTextView(Context context, AttributeSet attrs) {
super(context, attrs);
if( isLegacy() ) {
allCaps = attrs.getAttributeBooleanValue("http://schemas.android.com/apk/res/android", "textAllCaps", false);
if(allCaps) setText(getText()); // this line is really stupid, but initial setText() is called in TextView constructor, once allCaps isn't yet properly set...
}
package com.elimidateapp.android.customs;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.TextView;
public class MyTextView extends TextView {
private boolean allCaps = false;
@meeDamian
meeDamian / ionExample.java
Created September 23, 2013 10:16
Simple download JSON example using koush/Ion
Ion.with(this, "http://your-url.com/file.json")
.asJsonObject()
.setCallback(new FutureCallback<JsonObject>() {
@Override
public void onCompleted(Exception e, JsonObject result) {
if( e!=null ) {} // do stuff on fail
if( json!=null ) {} // do stuff on success
}
});