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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
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 string | |
| def checkio(text): | |
| text = text.lower() | |
| return max(string.ascii_lowercase, key=lambda ch: text.count(ch)) |
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
| def left_join(phrases): | |
| return ",".join(phrases).replace("right","left") | |
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
| def flatten(dictionary): | |
| stack = [((), dictionary)] | |
| result = {} | |
| while stack: | |
| path, current = stack.pop() | |
| for k, v in current.items(): | |
| if isinstance(v, dict): | |
| stack.append((path + (k,), v)) | |
| else: | |
| result["/".join((path + (k,)))] = v |
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
| safe_pawns=lambda s:sum(chr(ord(i[0])-1) + str(int(i[1])-1)in s or chr(ord(i[0])+1) + str(int(i[1])-1)in s for i in s) |
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
| def check_connection(network, first, second): | |
| path = {first} | |
| check = 0 | |
| while (len(path) > check): | |
| check = len(path) | |
| for i in network: | |
| one,two = i.split("-") | |
| if one in path or two in path: | |
| path.add(one) |
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
| sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-common vim-gui-common | |
| sudo apt-get build-dep vim-gnome | |
| sudo apt-get install liblua5.1-dev luajit libluajit-5.1 python-dev ruby-dev libperl-dev mercurial libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev | |
| sudo rm -rf /usr/local/share/vim | |
| sudo rm /usr/bin/vim | |
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 UIKit | |
| import AVFoundation | |
| class MSCameraViewController: UIViewController ,AVCaptureMetadataOutputObjectsDelegate { | |
| var input:AVCaptureDeviceInput! | |
| var output:AVCaptureStillImageOutput! | |
| var session:AVCaptureSession! | |
| var camera:AVCaptureDevice! | |
| var cameraPosition:NSInteger! // 0 = back, 1 = front |
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
| func cropImage(image:UIImage) -> UIImage { | |
| var srcImage:UIImage = image; | |
| // 画像の回転禁止 | |
| UIGraphicsBeginImageContext(srcImage.size) | |
| srcImage.drawInRect(CGRectMake(0, 0, srcImage.size.width, srcImage.size.height)) | |
| srcImage = UIGraphicsGetImageFromCurrentImageContext() | |
| UIGraphicsEndImageContext() |
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 'bundler' | |
| Bundler.require | |
| webpay = WebPay.new('xxxxxx') | |
| WEBPAY_PUBLIC_KEY = 'xxxxxx') | |
| MAMORIO_PRICE = 3500 | |
| set :slim, format: :html5 | |
| get '/' do |
OlderNewer