Skip to content

Instantly share code, notes, and snippets.

View shaobos's full-sized avatar

Shaobo Sun shaobos

  • Sunnyvale, California, US
View GitHub Profile
int main() {
vector<int> b;
b.push_back(-6);
b.push_back(-4);
int a = 3;
for(vector<int>::iterator iter = b.begin(); iter!= b.end(); iter++){
if (a < iter) {
cout<<"noooo"<<endl;
}
}
class Solution {
public:
int reverse(int x) {
int quotient = 0;
int residue = 0;
int reversed_integer = 0;
while (x!=0) {
residue = x%10;
x = x/10;
reversed_integer = reversed_integer * 10 + residue;
int chec_balance (TreeNode* node) {
if (node == NULL) {
return 0;
}
int l = check_balance(node->left);
int r = ...
if (l == -1 || r== -1) {
return -1;
}
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
// https://oj.leetcode.com/problems/distinct-subsequences/
// is my solution correct by any means?
class Solution {
public:
int numDistinct(string S, string T) {
int result = 0;
int length_S = S.size();
int length_T = T.size();
is_distinct(0, 0, S, T, result, length_S, length_T);
var trs = document.getElementsByTagName("tr")
var length = trs.length
var failed_projects = ["failed projects:"]
var failed_projects_without_link = ["these failed projects don't have a link to failure:"]
for (var i = 0; i<length; i++) {
var product_name = null
var is_failed = false
var link
var tds = trs[i].getElementsByTagName("td")
<div class="otg-market-data">
<div class="otg-market-data-inner">
<div class="otg-market-data-main">
<div class="otg-market-data-na-container">
<a class="otg-market-data-close-link" href="#">&times;</a>
<div class="otg-market-data-name">5M: 5th and Minna</div>
<div class="otg-market-data-address">
<a href="https://maps.google.com?q=410+Minna+St%2C+San+Francisco" target="_blank">410 Minna St, San Francisco</a>
</div>
</div>
@shaobos
shaobos / gist:fe4df4a64fabadad3fe3
Created May 5, 2015 05:13
off the grid script
/**
* Copyright (c) 2007-2013 Ariel Flesler - aflesler<a>gmail<d>com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* @author Ariel Flesler
* @version 1.4.6
*/
;(function($){var h=$.scrollTo=function(a,b,c){$(window).scrollTo(a,b,c)};h.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1,limit:true};h.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(e,f,g){if(typeof f=='object'){g=f;f=0}if(typeof g=='function')g={onAfter:g};if(e=='max')e=9e9;g=$.extend({},h.defaults,g);f=f||g.duration;g.queue=g.queue&&g.axis.length>1;if(g.queue)f/=2;g.offset=both(g.offset);g.over=both(g.over);return this._scrollable().each(function(){if(e==n
"{
\"1\": {
\"id\": \"1\",
\"name\": \"5M: 5th and Minna\",
\"latitude\": \"37.782116\",
\"longitude\": \"-122.406235\",
\"market_type\": \"market\",
\"distance\": \"5837.980323978116\",
\"region\": \"San Francisco\",
\"truck_count\": \"6\",

Keybase proof

I hereby claim:

  • I am shaobos on github.
  • I am shaobo_sun (https://keybase.io/shaobo_sun) on keybase.
  • I have a public key ASC36LX-l382tAh0_2qm2ftac-h-VuF2bHT8UWOE7a99rAo

To claim this, I am signing this object: