View recovery.sql
select *,from_unixtime(dateline) from ims_checkin_payment where status = 1 and tid like '20180227%' order by dateline desc;
select *,from_unixtime(dateline) from ims_checkin_payment where status = 1 and tid like '20180228%' order by dateline desc;
create table ims_checkin_payment_20180228 as select * from ims_checkin_payment;
insert into ims_checkin_payment (uid, rid, uniacid, tid, amount,dateline, status,weixin_order_id,merchant_order_id)
select uid, rid, uniacid, tid, amount,'1519783300', status,weixin_order_id,merchant_order_id
from ims_checkin_payment where status = 1 and tid like '20180227%';
select *,from_unixtime(dateline) from ims_checkin_payment where status = 1 and tid like '20180227%' and dateline='1519783300' or status = 1 and tid like '20180228%' order by dateline desc;
View oledb_create_excel.cs
var connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\\ExcelWorkBook.xls;Extended Properties=Excel 8.0";
using (var excelConnection = new OleDbConnection(connectionString))
{
// The excel file does not need to exist, opening the connection will create the
// excel file for you
excelConnection.Open();
// data is an object so it works with DBNull.Value
object propertyOneValue = "cool!";
object propertyTwoValue = "testing";
View node-gyp.cmd
npm config set msvs_version 2015
View jquery_float.js
$.fn.smartFloat = function() {
var position = function(element) {
var top = element.position().top, pos = element.css("position");
$(window).scroll(function() {
var scrolls = $(this).scrollTop();
if (scrolls > top) {
if (window.XMLHttpRequest) {
element.css({
position: "fixed",
top: 0
View using lodash template in c#.js
_.templateSettings = {
interpolate : /\{\{(.+?)\}\}/g, // print value: {{ value_name }}
evaluate : /\{%([\s\S]+?)%\}/g, // excute code: {% code_to_execute %}
escape : /\{%-([\s\S]+?)%\}/g // excape HTML: {%- <script> %} prints &lt;script&gt;
};
View Utils.cs
public class Utils
{
public static object DataTableToObject(DataTable dataTable)
{
var list = new List<object>();
foreach (DataRow row in dataTable.Rows)
{
var pairList = new List<KeyValuePair<string, object>>();
foreach (DataColumn column in dataTable.Columns)
{
View gist:54b4432fffaf0c67b176
<?php
function getTaobaoURLFromShortURL($shortURL)
{
$contents = file_get_contents($shortURL);
$pattern = '/d="J_Url" value=\'(.+)\'>./';
preg_match($pattern, $contents, $matches);
return urldecode($matches[1]);
}
function getItemIdFromURL($itemURL)
View onlineview.sql
SELECT
d.parent_id, views, cdn,
from_unixtime(1405267200 + row_number * 60) as step_time
FROM
(SELECT
apptype_id, game_id, count(view_id) AS views, r.row_number,
sum(bytes_loaded_cdn1 + bytes_loaded_cdn2 + bytes_loaded_cdn3 + bytes_loaded_cdn4) /duration as cdn
FROM
(SELECT
@curRow:=@curRow + 1 AS row_number
View ErrorLogAnalyze.scala
import scala.io._
import java.io._
import java.util.regex._
object ErrorLogAnalyze {
def main(args: Array[String]) = {
val files = if (args.length == 0) new File(".") else new File(args(0))
val lines = getLogs(files.listFiles.filter(_.getName.contains("error")).toList)
val errorAndHeartbeat = lines.partition(line => line.contains("ERROR") && line.contains("HEARTBEAT"))._1
View TrafficGenerator.scala
import scala.collection.mutable.LinkedList
import scala.collection.mutable.ListBuffer
import scala.compat._
import java.io._
import java.net._
import java.util._
import scala.util.Random
import java.nio.charset.Charset
import java.util.concurrent._
import java.util.concurrent.atomic._