This file contains 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
<?xml version="1.0" encoding="utf-8" ?> | |
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
<CodeSnippet Format="1.0.0"> | |
<Header> | |
<Title>Class Extension</Title> | |
<Shortcut>vcext</Shortcut> | |
<Description>Add Method To Existing Class With Extension</Description> | |
<Author>Venj Chu</Author> | |
<SnippetTypes> | |
<SnippetType>Expansion</SnippetType> |
This file contains 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
namespace System | |
{ | |
public static class StringExtension | |
{ | |
public static string TimesMe(this String str, int times) | |
{ | |
StringBuilder sb = new StringBuilder(); | |
for (int i = 0; i < times; i++) | |
{ |
This file contains 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 ruby | |
require "open-uri" | |
ARGV[0].to_i.times {|i| open "http://www.sh-anfang.org/expert/expert.asp?tp=5&id=5"; puts "已刷#{i + 1}票。" } | |
puts "完成" | |
# One-liner: | |
# ruby -ropen-uri -e "2.times {|i| open 'http://www.sh-anfang.org/expert/expert.asp?tp=5&id=5'; puts \"已刷#{i + 1}票。\" };puts '完成' " |
This file contains 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 xcrun swift | |
import Foundation | |
if NSFoundationVersionNumber < 1139.1 { | |
println("You need Xcode6-DP5 and up to run this script") | |
exit(1) | |
} | |
let args = Process.arguments |
This file contains 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 | |
extension UIColor { | |
convenience init(kmlColorString:String) { | |
var scanner = NSScanner(string:kmlColorString) | |
var color:UInt32 = 0; | |
scanner.scanHexInt(&color) | |
let mask:UInt32 = 0x000000FF | |
var a = color >> 24 & mask |
This file contains 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 ruby | |
# Will download to Files in current directory. | |
# To download: | |
# ruby down.rb | |
require "open-uri" | |
require "fileutils" | |
include FileUtils | |
USER = "data_public" |
This file contains 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
http://devstreaming.apple.com/videos/wwdc/2014/403xxksrj0qs8c0/403/403_hd_intermediate_swift.mov?dl=1 | |
http://devstreaming.apple.com/videos/wwdc/2014/419xxli6f60a6bs/419/419_hd_advanced_graphics_and_animation_performance.mov?dl=1 | |
http://devstreaming.apple.com/videos/wwdc/2014/101xx36lr6smzjo/101/101_hd.mov?dl=1 | |
http://devstreaming.apple.com/videos/wwdc/2014/236xxwk3fv82sx2/236/236_hd_building_interruptible_and_responsive_interactions.mov?dl=1 | |
http://devstreaming.apple.com/videos/wwdc/2014/306xxjtg7uz13v0/306/306_hd_javascript_for_automation.mov?dl=1 | |
http://devstreaming.apple.com/videos/wwdc/2014/404xxdxsstkaqjb/404/404_hd_advanced_swift.mov?dl=1 | |
http://devstreaming.apple.com/videos/wwdc/2014/701xx8n8ca3aq4j/701/701_hd_designing_accessories_for_ios_and_os_x.mov?dl=1 | |
http://devstreaming.apple.com/videos/wwdc/2014/224xxxlsvigdoc0/224/224_hd_core_os_ios_application_architectural_patterns.mov?dl=1 | |
http://devstreaming.apple.com/videos/wwdc/2014/717xxux5eg6f9v4/717/717_hd_kids_and_apps.mov?dl=1 | |
http://devstreaming.ap |
This file contains 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
#!/bin/sh | |
if [ $UID -ne 0 ]; then | |
echo "\033[31mSuperuser privileges are required to run this script.\033[0m" | |
echo "e.g. \"\033[33msudo\033[0m $0\"" | |
exit 1 | |
fi | |
driver=AX88179_178A.kext | |
driver_path=/Library/Extensions/$driver |
This file contains 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 ruby | |
# Rotate video files. | |
require 'shellwords' | |
require 'colorize' | |
TMPFILE = "/tmp/ffprobe_out.txt" | |
IMAGES = ["mjpeg", "jpg", "jpeg", "png", "gif"] | |
if (`which ffmpeg` == "") | |
puts "You need ffmpeg to use this command." |
This file contains 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 ruby | |
# encoding = UTF-8 | |
# 模拟导航数据转换GPS坐标算法 | |
# 接受一个参数,指定模拟导航数据文件的名字 | |
path = ARGV[0] | |
open("result.txt", "w+") do |f| | |
open(path).each_line do |line| | |
x, y = line.sub("[", "").sub("]", "").split(",").map {|i| |