Skip to content

Instantly share code, notes, and snippets.

View CaiJimmy's full-sized avatar

Jimmy CaiJimmy

  • Zürich, Switzerland
  • 11:25 (UTC +01:00)
View GitHub Profile
@CaiJimmy
CaiJimmy / content.js
Last active August 29, 2015 14:18
Ghost More标签
content = function (options) {
var truncateOptions = (options || {}).hash || {};
truncateOptions = _.pick(truncateOptions, ['words', 'characters', 'more']);
_.keys(truncateOptions).map(function (key) {
truncateOptions[key] = parseInt(truncateOptions[key], 10);
});
if (truncateOptions.hasOwnProperty('words') || truncateOptions.hasOwnProperty('characters')) {
// Due to weirdness in downsize the 'words' option
// must be passed as a string. refer to #1796
@CaiJimmy
CaiJimmy / form.html
Created April 4, 2015 15:12
Simple PHP form
<section id="form">
<form action="/post.php" method="POST" id="contribuir">
<section id="form-wrap">
<input name="name" type="text" placeholder="Tu nombre*" id="nombre"/>
<input name="email" type="mail" placeholder="E-mail(No será publicado)" id="email"/>
<input name="titulo" type="text" placeholder="El titulo*"/>
<textarea rows="8" name="contenido" required="true" id="contenido" placeholder="El contenido*"></textarea>
<input type="submit" name="submit" id="submit" value="Enviar">
</section>
</form>
@CaiJimmy
CaiJimmy / config.js
Created May 12, 2015 12:41
Ghost on openshift
// # Ghost Configuration
// Setup your Ghost install for various environments
// Documentation can be found at http://support.ghost.org/config/
var path = require('path'),
config;
var config;
if (process.env.OPENSHIFT_MYSQL_DB_HOST != undefined) {
config = {
// ### Production
@CaiJimmy
CaiJimmy / index.html
Last active April 29, 2024 08:43
Disqus点击加载
<button id="load-disqus" onclick="disqus.load();">
加载Disqus
</button>
<div id="disqus_thread"></div>
@CaiJimmy
CaiJimmy / absolute.js
Last active August 29, 2015 14:22
七牛镜像地址替换
$('img[src^="https://nichijou.org/content/images"]').each(function(){
var src = $(this).attr("src")
var newsrc = src.replace( 'https://nichijou.org', '//CDN-URL.qbox.me' );
$(this).attr("src", newsrc );
})
@CaiJimmy
CaiJimmy / config.js
Last active August 14, 2020 04:53
M. Theme Config
var MConfig = {
siteName: "{{@blog.title}}",
twitterName: '',
qiniuURL: '',
defaultColor: '#00BCD4',
loadMore: '0',
disqus_load: '0',
disqus_shortname: ''
}
@CaiJimmy
CaiJimmy / Archive.js
Last active April 16, 2022 08:16
Ghost Archive Page
$(document).ready(function(){
if($('#archivePage').length){
var $item = $('.archiveList--item'),
dates = {};
$item.each(function(){
dates[$(this).data('date')] = '';
});
for (date in dates) {
@CaiJimmy
CaiJimmy / Post.hbs
Created January 20, 2017 23:49
Ghost Lazyload images
<section class="post-content">
<noscript>{{content}}</noscript>
</section>
@CaiJimmy
CaiJimmy / keybase.md
Last active January 7, 2018 20:45
keybase.md

Keybase proof

I hereby claim:

  • I am CaiJimmy on github.
  • I am jimmycai (https://keybase.io/jimmycai) on keybase.
  • I have a public key whose fingerprint is AB5B 5B5A 9B33 78C6 7FA9 B6C2 E3D5 D635 F780 1C9E

To claim this, I am signing this object:

@CaiJimmy
CaiJimmy / config.toml
Last active July 23, 2017 09:20
Hugo Search
[outputs]
home = ["HTML", "RSS", "JSON"]