Skip to content

Instantly share code, notes, and snippets.

View egoist's full-sized avatar
🙏
Please support my open-source projects!

EGOIST egoist

🙏
Please support my open-source projects!
View GitHub Profile
let interestingNumbers = [
"Prime": [2, 3, 5, 7, 11, 13],
"Fibonacci": [1, 1, 2, 3, 5, 8],
"Square": [1, 4, 9, 16, 25],
]
var largest = 0
for (kind, numbers) in interestingNumbers {
for number in numbers {
if number > largest {
largest = number
function getTitle(weekday){
var t = new Date();
t = t.getDay();
var title = '';
switch(weekday){
case 1:
title = '周一';
break;
case 2:
title = '周二';
@egoist
egoist / mustache.js
Created December 29, 2014 20:51
mustache.js original file
/*!
* mustache.js - Logic-less {{mustache}} templates with JavaScript
* http://github.com/janl/mustache.js
*/
/*global define: false*/
(function (root, factory) {
if (typeof exports === "object" && exports) {
factory(exports); // CommonJS

Don't you?

@egoist
egoist / 0_reuse_code.js
Last active August 29, 2015 14:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@egoist
egoist / insekai_api.md
Last active August 29, 2015 14:12
里世界のAPI 1.0

Parameters:

  • page: 分页,默认为 1
  • limit: 每页数量,默认为 20

###获取最新状态

GET https://insekai.com/api/latest

TEST OK

@egoist
egoist / vagrant-lnmp-slim.md
Last active August 29, 2015 14:12
Vagrant prototype / ubuntu 14.04

###Prepare

0.Install aria

wget http://downloads.sourceforge.net/project/aria2/stable/aria2-1.18.8/aria2-1.18.8-osx-darwin.dmg or paste the URL in your browser to download it.

1.Install VirtualBox

aria2c -s10 -x10 http://download.virtualbox.org/virtualbox/4.3.20/VirtualBox-4.3.20-96996-OSX.dmg

div
div(style='width:100%;margin:0;padding:0', width='100%')
table(cellpadding='0', border='0', cellspacing='0', style='border-collapse:collapse;background:#eee;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;width:100%;height:100%;text-align:left', width='100%', align='left', height='100%')
tbody
tr
td(style='border-collapse:collapse;padding:32px 0;background-color:#eeeeee', align='center', bgcolor='#eeeeee')
table(cellpadding='0', border='0', cellspacing='0', style='border-collapse:collapse')
tbody
tr
td(align='left', style='border-collapse:collapse;background:#fff;padding:32px;min-width:320px;max-width:525px;height:100%', height='100%')
@egoist
egoist / bubbleSort.js
Created January 20, 2015 10:09
JavaScript 冒泡排序
// 冒泡排序
function bubbleSort(array) {
var temp;
for (var i = 0; i < array.length - 1; i++) {
for (var j = 0; j < array.length - i - 1; j++) {
if (array[j] > array[j+1]) {
temp = array[j];
array[j] = array[j+1];
array[j+1] = temp;
@egoist
egoist / Snaply.md
Last active August 29, 2015 14:16
Snaply Prototype