Skip to content

Instantly share code, notes, and snippets.

@kkabdol
kkabdol / app_engine_snippet.txt
Last active February 9, 2018 02:18
Google App Engine Snippet
* How to deploy Python3 app *
1. create 'app.yaml'
runtime: python
env: flex
entrypoint: gunicorn -b :$PORT main:app
runtime_config:
python_version: 3
# This sample incurs costs to run on the App Engine flexible environment.
@kkabdol
kkabdol / leap_payment_android.cpp
Last active January 5, 2018 07:33
Leap Payment Android
//////////////////////////////////////////////////////////////////
// LeapPayDefine_Android.h
//////////////////////////////////////////////////////////////////
enum LEAPPAY_RESULT
{
LEAPPAY_RESULT_ERROR = -1,
LEAPPAY_RESULT_SUCCESS = 0,
LEAPPAY_RESULT_CANCEL = 2,
LEAPPAY_RESULT_PARAMERROR = 3,
LEAPPAY_RESULT_NEEDLOGIN = 4,
@kkabdol
kkabdol / RearViewCamera.js
Created August 31, 2017 21:13
Interactive 3D Graphics Lesson 16
////////////////////////////////////////////////////////////////////////////////
// Rearview camera
////////////////////////////////////////////////////////////////////////////////
/*global THREE */
var camera, rearCam, scene, renderer;
var cameraControls;
var clock = new THREE.Clock();
@kkabdol
kkabdol / FourViewports.js
Last active August 31, 2017 20:58
Interactive 3D Graphics Lesson 16
////////////////////////////////////////////////////////////////////////////////
// Make 4 viewports
////////////////////////////////////////////////////////////////////////////////
/*global THREE */
var camera, topCam, sideCam, frontCam;
var scene, renderer;
var cameraControls;
var clock = new THREE.Clock();
@kkabdol
kkabdol / snippet.py3
Created August 30, 2017 21:28
Code snippets for Python3
// Degrees <-> Radians
import math
math.radians(deg)
math.degrees(rad)
@kkabdol
kkabdol / three_snippets.js
Last active July 27, 2022 01:27
Code snippets for three.js
// how to load a texture
var texture = THREE.ImageUtils.loadTexture( '/media/img/cs291/textures/grass512x512.jpg' );
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
texture.repeat.set( 10, 10 );
var solidGround = new THREE.Mesh(
new THREE.PlaneGeometry( 10000, 10000, 100, 100 ),
new THREE.MeshLambertMaterial( { map: texture } ) );
var texture = THREE.ImageUtils.loadTexture( '/media/img/cs291/textures/feather.png' );
var tail = new THREE.Mesh(
// Example program
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#define _USE_MATH_DEFINES
#ifndef M_PI
#define M_PI 3.14159265358979323846 // pi
@kkabdol
kkabdol / codingame_skynet-revolution-episode-2.cpp
Created May 25, 2017 08:45
Skynet Revolution - Episode 2
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cassert>
using namespace std;
// for optimization
@kkabdol
kkabdol / codingame_skynet-revolution-episode-1.cpp
Last active June 23, 2017 07:49
Codingame Skynet Revolution - Episode 1
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cassert>
using namespace std;
// for optimization
@kkabdol
kkabdol / codingame_snippets.cpp
Last active May 29, 2018 08:20
Code snippets for Codingame
#include <bits/stdc++.h>
//////////// cos sin //////////////
#include <cmath>
const double pi = std::acos(-1);
double cosByDegree( double degree )
{
const double radian = degree*pi/180.0;
return cos(radian);