Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
using namespace std;
int main() {
long long int n;
long long int m;
long long int a;
cin >> n;
cin >> m;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
// The source of this code is http://kasonblog.blogspot.tw/2012/04/10810-ultra-quicksort-uva-online-judge.html
// and its realted information http://program-lover.blogspot.tw/2008/10/mergesort.html
// or http://programming-study-notes.blogspot.tw/2013/12/uva-10810-ultra-quicksort.html
// or http://www.tuicool.com/articles/ANb6Fv
@s4553711
s4553711 / gist:063c444aeaa27064216b
Created June 20, 2014 10:04
Some example about phantomjs
var page = require('webpage').create();
var system = require('system');
var map_result = {
"Reference Sequence" : "mouse_mm10(UCSC)",
"Known SNP/Indel" : "dbSNP138",
"leftReadsInput" : "36730566",
"leftReadsMapped" : "35130795 (95.6% of input)",
"leftReadsOfThese" : "9607 ( 0.0%) have multiple alignments (11204 have >1)",
"rightReadsInput" : "36730566",
use Mojolicious::Lite;
use Text::Markdown qw/markdown/;
get '/' => sub {
my $self = shift;
$self->render('index');
};
get '/markdown' => sub {
my $self = shift;
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ck</groupId>
<artifactId>bioweb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>bio</name>
<description></description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@s4553711
s4553711 / Postgre-recursive-query-example
Created October 31, 2014 07:43
以下昰一個Recursive query的範例,只使用到一個表node,其中以id及parent組成其樹狀目錄結構的資訊。
WITH RECURSIVE node_rec(id, name, parent, type) as (
-- Non-recursive term
(
select id, name, parent, type from node where id = 566
)
UNION ALL
-- Recursive Term
-- Here I use 'UNION ALL' statement so that the duplicate result will be included.
-- You can choose to use 'UNION' instead of 'UNION ALL' to get distinct data.
(
@s4553711
s4553711 / gist:9afe5bcbc3902a663232
Created October 31, 2014 09:19
使用Sequence的值作為及將要新增欄位的值
-- Show current sequence val
select currval('nodefolder_id_seq'::regclass);
-- Let insert the data with currval as value
BEGIN;
insert into node (name,parent,type, project_id)
values ('TEST_Name',null,1,currval('nodefolder_id_seq'::regclass));
COMMIT;
-- Reference
@s4553711
s4553711 / gist:2f0a9032abe59a4da7c2
Created December 16, 2014 02:31
Call angular js from legacy code
// Source: http://stackoverflow.com/questions/10490570/call-angular-js-from-legacy-code
var scope = angular.element($('#todoList')[0]).scope()
// The original behavior of click will add up a variable with 1 and show it on the view, but it fact it doesn't update the veiw until
// user click the UI to trigger this function
scope.clikc();
// If I do it in this way, the result will the same with my expect
scope.$apply(function() {
scope.click();
});
[alias]
tree = "forest --pretty=format:\"%C(red)%h %C(magenta)(%ar) %C(blue)%an %C(reset)%s\" --style=15 --reverse --all"