Skip to content

Instantly share code, notes, and snippets.

template<typename T> class x {};
//typedef x xx;
class y {
void x() {}
x<int> z;
};
#include <iostream>
using namespace std;
class c {
public:
c() : c_(NULL) { cout << "c(" << c_ << ") this=" << this << endl; }
c(const c& c) : c_(&c) { cout << "c(" << c_ << ") this=" << this << endl; }
~c() { cout << "~c(" << c_ << ") this=" << this << endl; }
int f() { cout << "c(" << c_ << ").f() this=" << this << endl; return 0; }
private:
const c* c_;
\documentclass{article}
\begin{document}
\tableofcontents
\appendix
\section{alpha}
\section{beta}
\section{gamma}
\subsection{alfa}
\subsection{bravo}
\begingroup\def\addcontentsline#1#2#3\relax\subsubsection{FIRST}\endgroup
#include <cstdio>
#include <cstring>
#include <iostream>
#include <type_traits>
using namespace std;
enum { sz = 8 };
int main() {
cout << alignment_of<int>::value << endl;
mysql> show full processlist;
+-----+------+-----------------+-------+------------+------+----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-----+------+-----------------+-------+------------+------+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
import org.scalatra._
import scalate.ScalateSupport
object Web extends App {
import org.mortbay.jetty.Server
import org.mortbay.jetty.webapp.WebAppContext
val webapp = new WebAppContext
webapp.setDescriptor("src/main/webapp/WEB-INF/web.xml")
webapp.setResourceBase("src/main/webapp/")
val server = new Server(8080)
@yang
yang / gist:2419515
Created April 19, 2012 08:01
Bookmarklet to download Chrome extension files (CRX files) from Chrome webstore
If you want to access the source code of a Chrome extension, you need to get the .crx file. This bookmarklet downloads the .crx file for the Chrome extension you're viewing. You'll be prompted to install it; before dismissing the dialog, check in your Downloads directory. Then just unzip the .crx (it's a zip file).
javascript:window.open('https://clients2.google.com/service/update2/crx?response=redirect&x=id%3D' + /webstore\/detail\/([^\/]+)/.exec(window.location.href)[1] + '%26uc')
javascript:window.open%28%27https%3A//clients2.google.com/service/update2/crx%3Fresponse%3Dredirect%26x%3Did%253D%27%20%2B%20/webstore%5C/detail%5C/%28%5B%5E%5C/%5D%2B%29/.exec%28window.location.href%29%5B1%5D%20%2B%20%27%2526uc%27%29
@yang
yang / gist:3365293
Created August 16, 2012 01:16
Debugging Ubuntu 12.04 Desktop freeze
$ sudo lshw
zs
description: Tower Computer
product: Dell DXP061 ()
vendor: Winbond Electronics
serial: G5LYWD1
width: 64 bits
capabilities: smbios-2.3 dmi-2.3 vsyscall32
configuration: administrator_password=enabled boot=normal chassis=tower power-on_password=enabled uuid=44454C4C-3500-104C-8059-C7C04F574431
*-core
@yang
yang / main.jsx
Last active August 29, 2015 14:27
Testing out React diff algo
var TimerA = React.createClass({
getInitialState: function() {
return {start: this.props.start};
},
render: function() {
return (
<div>Seconds Elapsed: {this.state.start}</div>
);
}