This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const app = express(); | |
const morgan = require('morgan'); | |
const port = 3000; | |
// Define your morgan logger to log JSON to your client | |
// The object here takes your keys and strings that use | |
// the morgan token format | |
app.use(morgan(format({ | |
response_time: ':response-time', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
([]+[][+[]])[+!+[]+!+[]+!+[]+!+[]+!+[]][([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([][([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([]+[][+!+[]])[+!+[]]+([]+![])[+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+!![])[+!+[]]+([]+!![])[+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([]+!![])[+!+[]]][([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([]+[][+!+[]])[+!+[]]+([]+![])[+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+!![])[+!+[]]+([]+!![])[+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([]+!![])[+!+[]]](([]+!![])[+!+[]]+([]+[][+[]])[+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+!![])[+!+[]+!+[]]+([]+!![])[+!+[]]+([]+[][+!+[]])[+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[])[([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.wemakestuff.autoanswer" | |
android:versionCode="1" | |
android:versionName="0.1" > | |
<uses-sdk | |
android:minSdkVersion="8" | |
android:targetSdkVersion="19" /> | |
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PhoneAnswerIntentService extends IntentService { | |
/** | |
* Creates an IntentService. Invoked by the parent class's constructor. | |
*/ | |
public PhoneAnswerIntentService() { | |
super("PhoneAnswerIntentService"); | |
} | |
@Override | |
protected void onHandleIntent(Intent intent) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PhoneStateReceiver extends BroadcastReceiver { | |
@Override | |
public void onReceive(Context context, Intent intent) { | |
// Check phone state | |
String currentPhoneState = intent.getStringExtra(TelephonyManager.EXTRA_STATE); | |
// If the phone is ringing | |
if (currentPhoneState.equals(TelephonyManager.EXTRA_STATE_RINGING)) { | |
// If the phone is already in a call, ignore this call. | |
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OnDemandSingleton { | |
private OnDemandSingleton() { } | |
private static class OnDemandSingletonHolder { | |
public static final OnDemandSingleton instance = new OnDemandSingleton(); | |
} | |
public static OnDemandSingleton getInstance() { | |
return OnDemandSingletonHolder.instance; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EagerStaticSingleton { | |
private static EagerStaticSingleton instance = null; | |
private EagerStaticSingleton() { } | |
static { | |
try { | |
instance = new EagerStaticSingleton(); | |
} catch (Exception e) { | |
// Do something |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EagerSingleton { | |
private static final EagerSingleton instance = new EagerSingleton(); | |
private EagerSingleton() { } | |
public static EagerSingleton getInstance() { | |
return instance; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LazySingleton { | |
private static LazySingleton instance = null; | |
private LazySingleton() { } | |
public static synchronized LazySingleton getInstance() { | |
if (instance == null) { | |
instance = new LazySingleton(); | |
} | |
return instance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using the Telescoping Constructor anti-pattern | |
Car carSearchCriteria = new Car(1998, null, "Focus", "Sedan"); | |
// Using the Builder Pattern | |
Car carSearchCriteria = new Car.Builder().year(1998) | |
.model("Focus") | |
.carType("Sedan") | |
.build(); |
NewerOlder