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
// run gradle jar in the command line to get the jar | |
plugins { | |
java | |
application | |
kotlin("jvm") version "1.3.60" | |
} | |
repositories { | |
mavenCentral() | |
} |
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
class SampleAdapter : RecyclerView.Adapter<SampleAdapter.ViewHolder>() { | |
private var list: List<Sample> = listOf() | |
override fun getItemCount(): Int = list.size | |
override fun onBindViewHolder(holder: SampleAdapter.ViewHolder, position: Int) { | |
holder.bind(list[position]) | |
} | |
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SampleAdapter.ViewHolder { |
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
// Activity::onCreate | |
val job = Job() | |
val coroutineScope = CoroutineScope(Dispatchers.IO + job) | |
coroutineScope.launch { | |
val json = URL("https://jsonplaceholder.typicode.com/posts?_limit=5").readText() | |
withContext(Dispatchers.Main) { | |
findViewById<TextView>(R.id.title).text = json | |
} | |
} |
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
package app.smth.kotlin | |
data class Language(val name: String, val hotness: Int) | |
class MyLibrary { | |
fun kotlinLanguage() = Language("Kotlin", 10) | |
companion object { | |
@JvmStatic | |
fun main(args: Array<String>) { |
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
// for each element | |
this.style['-ms-grid-column'] = Math.floor(i % 4) + 1; // 4 is the column number per row | |
this.style['-ms-grid-row'] = Math.floor(i / 4) + 1; // 4 is the column number per row |
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
# Advanced config for NGINX | |
server_tokens off; | |
add_header X-XSS-Protection "1; mode=block"; | |
add_header X-Content-Type-Options nosniff; | |
# Redirect all HTTP traffic to HTTPS | |
server { | |
listen 80; | |
server_name www.domain.com domain.com; | |
return 301 https://$host$request_uri; |
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 Microsoft.AspNet.Builder; | |
using Microsoft.Framework.DependencyInjection; | |
namespace WebApi | |
{ | |
public class Startup | |
{ | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddMvc(); |
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
/* Code/app-0.5.0/resources/app/client/vs/monaco/ui/workbench/native/native.main.css */ | |
.monaco-editor.vs, | |
.monaco-editor.vs .zone-widget .monaco-editor { | |
background-color: #fdf6e4; | |
} | |
.monaco-editor, | |
.monaco-editor-background { | |
background-color: #fdf6e4; |
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
var uuid = require('node-uuid'), | |
https = require('https'); | |
function iCloud(appleId, password) { | |
this.urls = { | |
"version" : "https://www.icloud.com/system/version.json", | |
"validate": "/setup/ws/1/validate?clientBuildNumber={0}&clientId={1}", | |
"login": "/setup/ws/1/login?clientBuildNumber={0}&clientId={1}" | |
} |
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
var fs = require('fs'), | |
sys = require('sys'), | |
http = require('http'); | |
http.createServer(function (req, res) { | |
checkBalanceFile(req, res); | |
}).listen(8000); | |
function checkBalanceFile(req, res) { | |
fs.stat("balance", function(err) { |