Skip to content

Instantly share code, notes, and snippets.

View junhua's full-sized avatar
🎯
Focusing

Junhua LIU, PhD junhua

🎯
Focusing
View GitHub Profile
@junhua
junhua / TF2_sample.py
Last active January 24, 2020 12:30
TF2 sample
import tensorflow as tf
# print(tf.__version__)
mnist = tf.keras.datasets.mnist
(training_images, training_labels) , (test_images, test_labels) = mnist.load_data()
training_images = training_images/255.0
test_images = test_images/255.0
@junhua
junhua / PhaserFillscreen.js
Created April 2, 2018 06:43 — forked from netcell/PhaserFillscreen.js
Setting for Phaser.js to fill the screen on web browsers and Cocoon.js
/** Config part */
var FIXED_SIZE = 600;
var FIXED_MEASURE = 'Height';
/** Name maping */
var fixedName = FIXED_MEASURE;
var resName = fixedName === 'Height' ? 'Width' : 'Height';
var FIXED_NAME = fixedName.toUpperCase();
var RES_NAME = resName.toUpperCase();

Phaser Cheatsheet

This is the content from the original Phaser cheatsheet, the site of which went down. I'm editing outdated information as I come across it.

Starting a new game

Reference: http://docs.phaser.io/Phaser.Game.html#Game

var game = new Phaser.Game(width, height, renderer, "parent");
//All parameters are optional but you usually want to set width and height
//Remember that the game object inherits many properties and methods!
import subprocess as sub
import threading
class RunCmd(threading.Thread):
def __init__(self, cmd, timeout):
threading.Thread.__init__(self)
self.cmd = cmd
self.timeout = timeout
def run(self):
# Not all import used
from __future__ import absolute_import
from celery import shared_task, current_task
from apps.common.util import kill_process
from django.conf import settings
from django.core.files.base import ContentFile
from django.core.files.storage import default_storage
import subprocess as sub
# Not all imports are used
from __future__ import absolute_import
from celery import shared_task, current_task
from apps.common.util import kill_process
from django.conf import settings
from django.core.files.base import ContentFile
from django.core.files.storage import default_storage
import subprocess as sub

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation