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
$translateProvider.translations('cn', {
'GLOBAL':{
'save': '保存',
'cancel': '取消',
'confirm': '确定'
},
'NAV':{
'file': {
'title': '文件',
'option': {
$translateProvider.translations('cn', {
'GLOBAL':{
'save': '保存',
'cancel': '取消',
'confirm': '确定'
},
'NAV':{
'file': {
'title': '文件',
'option': {
{
"font_face": "Menlo Plus",
"font_size": 13,
"tab_size": 4,
"translate_tabs_to_spaces": true,
"line_padding_top": 1.1,
"line_padding_bottom": 1.1
}
@egoist
egoist / delAllFilesinFolder.php
Created November 21, 2014 02:39
删除目录下所有文件
<?
$files = glob('path/to/temp/*'); // get all file names
foreach($files as $file){ // iterate files
if(is_file($file))
unlink($file); // delete file
}
@egoist
egoist / make_image_pos_center.js
Last active August 29, 2015 14:10
图片由于缓存所以不会每次使用 .load() 都会有效果 【解决方案】
var el = $('img');
el.one("load", function() {
//do something, for me I wanna make the position vertical center, so I call function center();
}).each(function() {
if(this.complete) $(this).load();
});
/*
function center(){
var marginTop = 0;
if(strpos($text, 'www.xiami.com')){
$text = preg_replace('/http:\/\/www.xiami.com\/song\/([a-zA-Z0-9\=]+)?/', '<iframe src="//inmusic.sinaapp.com/xiamiplayer/\1" frameborder="0" scrolling="0" width="420" height="200" allowtransparency></iframe>', $text);
}
.button {
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
background: #c83737;
border-bottom: 2px solid #a02c2c;
color: white;
display: inline-block;
font: bold 26px/1 "myriad-pro", "Myriad Pro", sans-serif;
letter-spacing: -1px;

按日期获取

Type: GET

URL: https://insekai.com/api/get_unravel_by_date/YOUR_DATE

YOUR_DATE: YYYYMMDD

RESPONSE:

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 = '周二';