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
| curl -L https://www.atom.io/api/updates/download -A "Atom/0.1 CFNetwork/1.5" > Atom.zip | |
| unzip Atom.zip | |
| mv Atom.app /Applications/ |
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
| // 1. How to check if one array has all elements of another? | |
| var importedEmails = ['john@doe.com', 'janet@doe.com'], | |
| existingEmails = ['john@doe.com', 'janet@doe.com', 'fred@mercury.com']; | |
| if(!_.difference(importedEmails, existingEmails).length) console.log('already imported') | |
| // > already imported | |
| // ********************************************************** | |
| // 2. How to find what elements are common to two arrays? |
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
| Function GETCITYNAME(district As Range, cities As Range) As String | |
| Dim X As Range | |
| For Each X In cities | |
| If InStr(1, district.Value, X.Value) > 0 Then | |
| GETCITYNAME = X.Value | |
| Exit For | |
| End If | |
| Next X | |
| End Function |
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
| function consoleTrick() { | |
| console.clear(); | |
| var rainbowStyle = 'background-image:-webkit-gradient( linear, left top, right top, color-stop(0, #f22), color-stop(0.15, #f2f), color-stop(0.3, #22f), color-stop(0.45, #2ff), color-stop(0.6, #2f2),color-stop(0.75, #2f2), color-stop(0.9, #ff2), color-stop(1, #f22) );color:transparent;-webkit-background-clip: text;font-size:2em;'; | |
| var msg = "来自博主的问候:欢迎来访,美图奉上 \\(^____^)/"; | |
| console.log("%c", "padding:50px 300px;line-height:120px;background:url('http://wayouliu.duapp.com/img/tagsImg/youth.gif') no-repeat;"); | |
| console.log('%c' + msg, rainbowStyle); | |
| var picNo = getRandomInt(1, 16); | |
| console.log("Print out the " + picNo + "th image."); | |
| console.log("%c", "padding:165px 150px;line-height:350px;background:url('http://wayouliu.duapp.com/img/tagsImg/" + picNo + ".jpg') no-repeat;"); | |
| console.log("%c 试试F5刷新", "color:green;"); |
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
| ```shell | |
| #101 A State Capitals Quiz | |
| #Once you have a tool for choosing a line randomly from a file, as we have with Script #76, Displaying Random Text, there's no limit to the type of quiz games you can write. In this instance, I've pulled #together a list of the capitals of all 50 states in the United States of America; this script randomly chooses one, shows the state, and asks the user to type in the matching capital. | |
| #The Code | |
| #!/bin/sh | |
| # states - A state capital guessing game. Requires the state capitals | |
| # data file at http://www.intuitive.com/wicked/examples/state.capitals.txt. |
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 'digest/md5' | |
| def gfm(text) | |
| # Extract pre blocks | |
| extractions = {} | |
| text.gsub!(%r{<pre>.*?</pre>}m) do |match| | |
| md5 = Digest::MD5.hexdigest(match) | |
| extractions[md5] = match | |
| "{gfm-extraction-#{md5}}" | |
| 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
| class TestHighLighting | |
| def code | |
| end | |
| 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
| require 'cgi' | |
| require 'digest/md5' | |
| require 'net/https' | |
| require 'uri' | |
| module Jekyll | |
| class GistTag < Liquid::Tag | |
| def initialize(tag_name, text, token) | |
| super | |
| @text = text |
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
| alias ls='ls --color=auto' |
OlderNewer