$ cd project_folder $ git init $ git add . $ git commit -a -m 'init' $ git remote add github https://github.com/evenchange4/101-1_MMP_HW1_Calculator.git $ git remote -v $ git pull github master $ git push github 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
| class AbstractNode | |
| @@root = nil | |
| def initialize(n, keys, parent) | |
| @slot = n | |
| @keys = keys | |
| @parent = parent | |
| @@root = self unless @@root | |
| end |
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
| #!/usr/bin/env python3 | |
| import sys | |
| import csv | |
| import plistlib | |
| import os | |
| csv_file = sys.argv[1] | |
| with open(csv_file, 'r', encoding='utf-8') as f: | |
| result = list(csv.DictReader(f)) |
Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.
For the sake of this example, let’s pretend the subfolder containing your site is named dist.
Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).
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
| #特殊的require 可以輕鬆使用參數 | |
| ### read argument | |
| require 'optparse' | |
| $options = {} | |
| OptionParser.new do |opts| | |
| opts.on("-r") { |s| $options[:r] = true } | |
| opts.on("-i", '-i INPUT', "input ") { |s| $options[:i] = s } # ./queries/origin/query-5.xml | |
| opts.on("-o", '-o OUTPUT',"output") { |s| $options[:o] = s } # ans | |
| opts.on("-m", '-m MODEL', "model ") { |s| $options[:m] = s } # ./model-files |
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
| // easing functions http://goo.gl/5HLl8 | |
| Math.easeInOutQuad = function (t, b, c, d) { | |
| t /= d/2; | |
| if (t < 1) { | |
| return c/2*t*t + b | |
| } | |
| t--; | |
| return -c/2 * (t*(t-2) - 1) + b; | |
| }; |
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
| /** | |
| * A generic confirmation for risky actions. | |
| * Usage: Add attributes: ng-really-message="Are you sure"? ng-really-click="takeAction()" function | |
| */ | |
| angular.module('app').directive('ngReallyClick', [function() { | |
| return { | |
| restrict: 'A', | |
| link: function(scope, element, attrs) { | |
| element.bind('click', function() { | |
| var message = attrs.ngReallyMessage; |
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
| uploader = $fileUploader.create( | |
| scope: $scope | |
| url: "http://#{$rootScope.api}/proposal/upload" | |
| formData: [{ | |
| key: \value | |
| }] | |
| filters: [ | |
| (item) -> | |
| if item.size >10000000 | |
| alert \size不得超過10mb |
