Skip to content

Instantly share code, notes, and snippets.

@malcommac
malcommac / TheMovieDB.swift
Created March 15, 2022 12:39
TheMovieDB Example in RealHTTP
public class MovieDBTest: XCTestCase {
/// The shared client with their settings.
private lazy var client: HTTPClient = {
client = HTTPClient(baseURL: "https://api.themoviedb.org/3")
// it will happens value to each call.
client.queryParams = [
.init(name: "api_key", value: "<API KEY>"),
.init(name: "language", value: "IT-it")
@tpb1908
tpb1908 / Extensions.kt
Created July 3, 2017 19:41
Useful Android Kotlin extension functions
package com.tpb.brainfuck
import android.support.design.widget.FloatingActionButton
import android.support.v7.widget.RecyclerView
import android.text.Editable
import android.text.TextWatcher
import android.util.Log
import android.widget.TextView
/**
@magicsih
magicsih / AesExample.cs
Last active May 4, 2023 12:33
AES Encryption/Decryption Example in C#
using System.Security.Cryptography;
using System.Text;
namespace AesExample
{
class Program
{
private const string ORIGINAL = "this is some data to encrypt";
private const string SAMPLE_KEY = "gCjK+DZ/GCYbKIGiAt1qCA==";
private const string SAMPLE_IV = "47l5QsSe1POo31adQ/u7nQ==";
// ------- HOW DEFINE A SINGLETON FOR VOLLEY REQUEST -------
// original source in Java: https://developer.android.com/training/volley/requestqueue.html
object MySingleton {
val TAG:String = "MySingleton"
var mRequestQueue:RequestQueue? = null
init {
Log.d(TAG, "init")
}
<?php
class Banxico
{
const banxicourl = 'http://www.banxico.org.mx:80/DgieWSWeb/DgieWS?WSDL';
private $_client;
private $_debug = false;
public function getExRate()
{
@alphamu
alphamu / SharedPreferencesSingletonEnumKeyTemplate.java
Last active March 9, 2023 11:59
A SharedPreferences singleton that can be used to centralise and simplify reading and writing of SharedPerferences in your Android app. There are 2 versions, one that uses static String for Keys and an other that uses enums. Which one you use comes down to your preference, enums I feel provides better control when you have multiple programmers w…
#if (${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
import android.content.Context;
import android.content.SharedPreferences;
/*
* A Singleton for managing your SharedPreferences.
*
* You should make sure to change the SETTINGS_NAME to what you want
* and choose the operating made that suits your needs, the default is
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@indyfromoz
indyfromoz / aspnet-mvc.gitignore
Created November 19, 2012 06:44
.Gitignore for ASP.NET MVC
###################
# compiled source #
###################
*.com
*.class
*.dll
*.exe
*.pdb
*.dll.config
*.cache