This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* c99-vector.c | |
* - Description: Simple std::vector-like container implemented in C99, without error handling and thread-safety | |
* - Author: Shao-Chung Chen | |
* - License: CC0 | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* c99-heap.c | |
* - Description: Simple std::priority_queue-like container implemented in C99, without error handling and thread-safety | |
* - Author: Shao-Chung Chen | |
* - License: CC0 | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stdbool.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// API access key from Google API's Console | |
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' ); | |
$registrationIds = array( $_GET['id'] ); | |
// prep the bundle | |
$msg = array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#define DATA_SIZE_LIMIT 30 | |
# | |
# how to compile and execute: | |
# gcc hopscotch.c -o hopscotch | |
# ./hopscotch < input.txt | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 2017/10/31 Happy Helloween | |
* Author: LeeXun leexun.official@gmail.com | |
* Just copy and paste it on console | |
* Notice: It's really dangerous if you don't know that this means! | |
* | |
*/ | |
function handleNewElement() { | |
var nodeList = document.getElementById('js_1').querySelectorAll("[aria-label='貼圖']"); | |
var s = nodeList[nodeList.length-1].style; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function isSubstring(a, b) { | |
let i = 0 | |
while(i < a.length - b.length){ | |
let j = 1 | |
if(a[i] == b[0]){ | |
while(true){ | |
if(a[i+j] == b[j]){ | |
if(j == b.length - 1){ | |
return i + j |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Two way binding</title> | |
<style> | |
#app { | |
width: 100%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
->leftJoin('likes', function($join) use ($viewer_id) { | |
$join->on('likes.customer_id', '=', DB::raw($viewer_id)); | |
$join->on('likes.like_type', '=', DB::raw(Like::LIKE_TYPE_PRODUCT)); | |
$join->on('likes.like_id', '=', 'oc_product.product_id'); | |
}) |
Code examples from this stack overflow answer.
OlderNewer