Skip to content

Instantly share code, notes, and snippets.

@mplacona
mplacona / Instructions
Created May 7, 2015 12:06
The Code Compiler
* create the script
* add a shortcut to it in your keyboards shortcut as shown in the screenshot (http://monosnap.com/image/idkRLKyEij1DC2bstdwUmznG0ODX3S)
using System;
class Program
{
static void Main(string[] args)
{
switch (gate)
{
case "1":
Console.WriteLine("Darkness - the world of demons");
@mplacona
mplacona / HttpHelper.java
Last active July 12, 2018 03:09
Android HTTP Helper
/*
* Copyright (c) 2011 by Twilio, Inc., all rights reserved.
*
* Use of this software is subject to the terms and conditions of
* the Twilio Terms of Service located at http://www.twilio.com/legal/tos
*/
package com.twilio.ipmessaging.util;
import java.io.IOException;
def make_call
client = Twilio::REST::Client.new your-sid, your-token
call = client.account.calls.create(
:from => your-twilio-number, # From your Twilio number
:to => your-real-number, # To any number
# Fetch instructions from this URL when the call connects
:url => 'your-ngrok-url'
)
// Add nice events to unit test results
// Just put it on the top level of your gradle module
tasks.matching {it instanceof Test}.all {
testLogging.events = ["failed", "passed", "skipped"]
}
using System;
using System.Globalization;
using System.Linq;
using System.Web.Mvc;
using Twilio;
using Twilio.TwiML;
using Twilio.TwiML.Mvc;
namespace TwilioBaseApp.Controllers
{
@mplacona
mplacona / Note.java
Created August 10, 2016 16:53
Exploring the vastness of the Realm, a cross-platform mobile database
public class Note extends RealmObject {
public String mText
}
Note note = new Note(); note.mText = "My awesome note";
Realm realm = Realm.getDefaultInstance();
realm.beginTransaction();
realm.copyToRealm(note)
realm.commitTransaction();
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'io.realm:realm-gradle-plugin:1.1.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
// other stuff commented out for brevity
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
<android.support.design.widget.FloatingActionButton
android:id="@ id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/ic_input_add" />