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
package main | |
import ( | |
"flag" | |
"log" | |
"math/rand" | |
"os" | |
"time" | |
) |
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
fs = require 'fs' | |
path = require 'path' | |
dataPath = './data' | |
fullPath = (name) -> path.join dataPath, name | |
evalFile = (name) -> eval fs.readFileSync(fullPath name).toString 'utf8' | |
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 dis | |
def f(): | |
False is False is False | |
def f2(): | |
1 <= 1 <= 1 | |
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
package main | |
import ( | |
"log" | |
"net/http" | |
"net/http/httputil" | |
"net/url" | |
) | |
func main() { |
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 arr (-> 100 range shuffle)) | |
(defn qsort [[pivot & remains]] | |
(when pivot | |
(let [left (for [x remains :when (< x pivot)] x) | |
right (for [x remains :when (> x pivot)] x)] | |
(lazy-cat (qsort left) (list pivot) (qsort right))))) | |
(-> arr qsort prn) |
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 unicodedata | |
def must_be_ascii(raw): | |
'''Convert all non-ascii characters to ascii substitutes. | |
:param raw: raw input. | |
''' | |
if not isinstance(raw, (str, unicode)): | |
raise TypeError('Cannot convert to ascii, expected str or unicode.') |
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
<?php | |
use Widget\Form; | |
use Widget\Checkbox; | |
class ProductPresenter { | |
protected $resource; | |
public function withProduct($product) |
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
<?php namespace Vtmer\Blog\Presenter; | |
use ArrayAccess; | |
use JsonSerializable; | |
use Illuminate\Support\Contracts\JsonableInterface; | |
use Illuminate\Support\Contracts\ArrayableInterface; | |
use Vtmer\Blog\Model\PostModel; | |
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
<?php namespace Vtmer\Blog\Model; | |
class PostModel extends \Eloquent { | |
// 文章查看相关的记录 | |
use PostVisitTrait; | |
// 作者关联定义 | |
use PostAuthorTrait; |