Skip to content

Instantly share code, notes, and snippets.

View travishen's full-sized avatar
🎹
Play till the end.

ssivart travishen

🎹
Play till the end.
View GitHub Profile
@travishen
travishen / memory-reference.ipynb
Last active June 26, 2018 07:19
to understand simple python memory managements
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@travishen
travishen / python-mutability.ipynb
Last active June 27, 2018 09:52
to understand the idea of mutability
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@travishen
travishen / javascript-function-overloading.js
Last active June 26, 2018 07:22
in JavaScript, functions are objects, so there is actually no overloading, but we can do encapsulations like this
function greet(firstname, lastname, language) {
language = language || 'en';
if (language === 'en') {
console.log('Hello ' + firstname + ' ' + lastname);
}
if (language === 'es') {
console.log('Hola ' + firstname + ' ' + lastname);
@travishen
travishen / python-encapsulation.ipynb
Created June 26, 2018 07:54
python class attribute encapsulation by getter and setter
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@travishen
travishen / jarvismenu-insert.js
Last active July 2, 2018 09:34
Smart admin jarvismenu dynamically insert elements and re-init
/*
* Source plugin: https://gist.github.com/kigamuka/1cd8360ae4a0f13c2b33
* Issue to solve: Scripting too many left nav multi-level items(over 20000+)
cause bad performance, need load element dynamically
* =======================================================================
* Example UI:
<ul>
<li>
<a id="target" href="#">parent anchor<b class="collapse-sign"><em class="fa fa-minus-square-o"></em></b></a>
// INSERT UL HERE...
@travishen
travishen / cpython-interning.ipynb
Last active July 8, 2018 10:13
cpython interning
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.