Skip to content

Instantly share code, notes, and snippets.

@changken
changken / 11-5wu.py
Last active January 20, 2018 07:44
chang geng wu 11-5
def k (a,b):
lst1 = []
lst2 = []
for i in range(0,9,3):
lst1.append(a[0+i:3+i])
for i in range(0,9,3):
lst2.append(b[0+i:3+i])
return lst1,lst2
def main():
@changken
changken / 6-29CreditCard.py
Last active January 20, 2018 07:45
credit card
import math
def isValid(number):
if prefixMatched(number, 4) or prefixMatched(number, 5) or prefixMatched(number, 37) or prefixMatched(number, 6):
total = sumOfOddPlace(number) + sumOfDoubleEvenPlace(number)
if total % 10 == 0:
return True
else:
return False
else:
@changken
changken / generateMatrix.py
Created January 4, 2018 07:54
三個換一行
def generateMatrix(value):
matrix = []
value = [eval(i) for i in value.split()]
c = 0 #換行標記
for i in range(3):
matrix.append([])
for j in range(c, c + 3):
matrix[i].append(value[j])
@changken
changken / pwStrong.py
Last active January 19, 2018 07:20
長度至少8個 字母至少1個 大寫字母至少1個 數字至少1個 奇怪符號至少1個
def countAlpha(pw):
countAlpha = 0
countBig = 0
for each in pw:
if each.isalpha():
countAlpha += 1
if each.isupper():
countBig += 1
return countAlpha, countBig
@changken
changken / Exchange.py
Created January 19, 2018 07:20
大轉小 小轉大 中間加空白
from sys import stdin
for row in stdin:
row = row.strip()
show = ""
for each in row:
if each.isupper():
show += each.lower() + " "
else:
show += each.upper() + " "
@changken
changken / E2_2.java
Created March 6, 2018 12:38
課本練習題2-2
package chapter02;
import java.util.*;
public class E2_2 {
public static void main(String[] args) {
//從鍵盤讀取物件
Scanner input = new Scanner(System.in);
@extends('tpl.main')
@section('title', '儲值')
@section('head')
<script>
$(function () {
$('#submit').click( function () {
if($('#key').val() == "")
{
@changken
changken / WalletController.php
Last active March 20, 2018 13:53
AJAX範例2
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Auth;
use App\User;
use App\Wallet;
use App\WalletCode;
use App\WalletLog;
@changken
changken / ListActivity.java
Created June 7, 2019 11:41
listView範例
package org.changken.tutorialsample;
import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
@changken
changken / README.txt
Created May 24, 2021 09:27
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.17+commit.bdeb9e52.js&optimize=false&runs=200&gist=
REMIX EXAMPLE PROJECT
Remix example project is present when Remix loads very first time or there are no files existing in the File Explorer.
It contains 3 directories:
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name.
2. 'scripts': Holds two scripts to deploy a contract. It is explained below.
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity.
SCRIPTS