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
// Delete files based on .gitignore without deleting local files | |
git rm --cached `git ls-files -i -X .gitignore` | |
git commit -m "Removed folder from repository" | |
git push origin master |
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
// Load image from assets folder | |
val tile = BitmapFactory.decodeStream(resources.assets.open("filename.png"), null, options) | |
// The amount canvas is scaling resource images (res/drawables) | |
var metrics = DisplayMetrics() | |
windowManager.defaultDisplay.getMetrics(metrics) | |
val logicalDensity = metrics.density | |
// These options will scale bitmaps to fit your screen pixel density |
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
// Swift cheat sheet. | |
// Comparision of Swift to C++ | |
// I used "Learning Swift - buidling apps for macOS, iOS and Beyond" book for reference | |
// comment | |
/* comment | |
*/ | |
// all the basic comparisons and arthmetic work the same a cpp + - / * || && etc | |
// these dont work ++, -- |
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
import sys, argparse, os, textwrap | |
if __name__ == "__main__": | |
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, | |
description=textwrap.dedent('''Relative Path Generator | |
----------------------- | |
Generates a list of files relative to a rootdirectory '''), | |
epilog='''Written by Peter Respondek''') | |
parser.add_argument("-r", help="directories will be relative to this position") | |
parser.add_argument("-x", help="only use this file extension") |
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
# I use python so infequently that i forget most of the stuff i learnt when next I need to use it. | |
# Here are some frequently used commands. Python 3.5 NOT 2.7 | |
# System variables: | |
__file__ | |
# Absolute path to current script | |
# Basic Syntax: |
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
###################################################################### | |
# | |
# FFMpeg command line frontend using python and TKinter. | |
# | |
# Requires Python 2.7 | |
# | |
# This is not an "easy mode" for ffmpeg. It's just a labour | |
# saving device for transcoding video files. You will need to download | |
# and install FFMpeg from http://ffmpeg.org and add ffmpeg as an | |
# environment variable. It's pretty basic right now but if you have |
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
attribute vec4 a_position; | |
attribute vec3 a_normal; | |
attribute vec2 a_texCoord; | |
attribute vec2 a_texCoord1; | |
varying vec2 v_texture_coord; | |
varying vec2 v_texture_coord1; | |
// height of the wave in world units. | |
uniform float u_amplitude; |
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
attribute vec4 a_position; | |
attribute vec2 a_texCoord; | |
attribute vec2 a_texCoord1; | |
attribute vec2 a_texCoord2; | |
attribute vec4 a_color; | |
varying vec4 v_color; | |
varying vec2 v_texture_coord; | |
varying vec2 v_texture_coord1; | |
varying vec2 v_texture_coord2; |
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
#ifdef GL_ES | |
varying mediump vec2 v_texture_coord; | |
varying mediump vec2 v_texture_coord1; | |
#else | |
varying vec2 v_texture_coord; | |
varying vec2 v_texture_coord1; | |
#endif | |
uniform sampler2D lightmap; | |
void main(void) |
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
attribute vec4 a_position; | |
attribute vec2 a_texCoord; | |
attribute vec2 a_texCoord1; | |
varying vec2 v_texture_coord; | |
varying vec2 v_texture_coord1; | |
void main(void) | |
{ | |
gl_Position = CC_MVPMatrix * a_position; | |
v_texture_coord.x = a_texCoord.x; |
NewerOlder