This file contains hidden or 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
// https://www.lwjgl.org/guide copy-pasted to JetBrains IDEA to convert syntax from Java to Kotlin. | |
// LWJGL 3 version 3.2.3 | |
import org.lwjgl.Version | |
import org.lwjgl.glfw.* | |
import org.lwjgl.glfw.Callbacks.* | |
import org.lwjgl.glfw.GLFW.* | |
import org.lwjgl.opengl.* | |
import org.lwjgl.opengl.GL11.* | |
import org.lwjgl.system.MemoryStack | |
import org.lwjgl.system.MemoryUtil |
This file contains hidden or 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
/** | |
* Print supported OpenGL API's to standard output up to OpenGL 4.6. | |
* | |
* @author Marcin Kolenda | |
*/ | |
import org.lwjgl.glfw.GLFW | |
import org.lwjgl.opengl.GL | |
import org.lwjgl.opengl.GLCapabilities | |
import org.lwjgl.system.MemoryUtil |
This file contains hidden or 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
(defpackage :cl-gauss-elimination | |
(:use :cl)) | |
(in-package :cl-gauss-elimination) | |
(defun solve-upper (U) | |
(let* ((d (array-dimension U 0)) | |
(x (make-array (list d) :initial-element 0))) | |
(loop for i from (1- d) downto 0 | |
do (setf (aref x i) |
This file contains hidden or 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 com.company; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import org.springframework.web.bind.annotation.RequestParam; | |
import org.springframework.web.bind.annotation.RestController; | |
import java.util.concurrent.atomic.AtomicLong; |
This file contains hidden or 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
module Main where | |
import System.Console.GetOpt | |
import System.Environment | |
data Flag = OptionA | OptionB | |
options :: [OptDescr Flag] | |
options = | |
[ Option ['a'] [] (NoArg OptionA) "Option A" | |
, Option ['b'] [] (NoArg OptionB) "Option B" |
This file contains hidden or 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 RandomCollection(UserList): | |
def get_random(self): | |
"""Get randomly element from this collection""" | |
max_it = len(self.data) - 1 | |
return self.data[randint(0, max_it)] | |
def random_boolean(probability=None): | |
if probability: |
This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or 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
MainWindow::MainWindow(QWidget *parent) : | |
QMainWindow(parent), ui(new Ui::MainWindow) | |
{ | |
// somewhere after ui->setupUi(this); | |
ui->mainToolBar->addWidget(spacer); | |
ui->mainToolBar->addWidget(new MyClickableBanner(this)); | |
// ... | |
} |
This file contains hidden or 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
#include "main.h" | |
#include <QPainter> | |
#include <plasma/theme.h> | |
MyPlasmaApplet::MyPlasmaApplet(QObject *parent, const QVariantList &args) : Plasma::Applet(parent, args) | |
{ // rather don't add other stuff here. Use init() instead | |
setBackgroundHints(DefaultBackground); |
This file contains hidden or 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
#include <QMenu> | |
#include <QAction> | |
MyWidget::MyWidget(QWidget* parent) : QWidget(parent) | |
{ | |
setContextMenuPolicy(Qt::CustomContextMenu); | |
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customContextMenuShow(QPoint))); | |
} | |
void MyWidget::customContextMenuShow(const QPoint& pos) |