Skip to content

Instantly share code, notes, and snippets.

<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
@smallsong
smallsong / HTML-presentation-tools.md
Last active August 29, 2015 14:26 — forked from vasilisvg/HTML-presentation-tools.md
HTML presentation tools

#HTML presentation tools

There are many HTML presentation tools and they are all created for slightly different reasons. Here's an overview. Please let me know if I forgot any.

##CSSS

CSS-based SlideShow System

/**
* Be sure to include library scripts in this order. Can be placed either
* in the header or footer.
*/
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-infinitescroll/2.0b2.120519/jquery.infinitescroll.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/masonry/3.1.2/masonry.pkgd.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/3.0.4/jquery.imagesloaded.min.js"></script>
@smallsong
smallsong / 1) Install
Created July 29, 2016 02:51 — forked from nghuuphuoc/1) Install
Install Redis on Centos 6
// --- Compiling ---
$ wget http://download.redis.io/releases/redis-2.8.3.tar.gz
$ tar xzvf redis-2.8.3.tar.gz
$ cd redis-2.8.3
$ make
$ make install
// --- or using yum ---
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
@smallsong
smallsong / directoryListing.php
Created July 5, 2018 08:37 — forked from brunoaugusto/directoryListing.php
Simple script to generate an ASCII graphic tree of given directory
<?php
$directory = './misc';
try {
$iterator = new RecursiveTreeIterator(
new RecursiveDirectoryIterator(
$directory, RecursiveDirectoryIterator::SKIP_DOTS
),
@smallsong
smallsong / timeStamp
Created July 16, 2018 06:28
安全获取10位时间戳
long timeStampSec = System.currentTimeMillis()/1000;
String timestamp = String.format("%010d", timeStampSec);
@smallsong
smallsong / common.java
Created July 16, 2018 08:04
map to queryString
public static String mapToQueryString(Map<String, String> map) {
StringBuilder string = new StringBuilder();
String queryString = map.entrySet()
.stream()
.map(Object::toString)
.collect(joining("&"));
if(map.size() > 0) {
string.append("?");
}
string.append(queryString);
@smallsong
smallsong / FileReaderHelper.java
Created August 3, 2018 01:57
springboot read resoures file
import org.springframework.stereotype.Component;
import org.springframework.util.ResourceUtils;
import java.io.*;
@Component
public class FileReaderHelper {
public String readToString(String fileName) {
String encoding = "UTF-8";
private String getRandom() {
int result = (int) ((Math.random() * 9 + 1) * 100000);
return Integer.toString(result);
}
@smallsong
smallsong / withoutEntity
Created August 13, 2018 09:07
直接把查询结果输出位Map
public List<?> findAllGameStateByUnitIdAndUserId(int unitId, int userId) {
Query query = entityManager.createNativeQuery("SELECT b.*, IF(c.id > 0, 1, 0) as is_finish FROM `wx_unit_game` a" +
" left join `wx_catalog` b on a.game_id = b.id" +
" left join `wx_unit_game_progress` c on c.game_id = a.game_id and c.user_id = :userId" +
" WHERE a.unit_id = :unitId and b.game_is_lock = 1");
query.unwrap(SQLQuery.class).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
query.setParameter("userId", userId);
query.setParameter("unitId", unitId);
List result = query.getResultList();