Skip to content

Instantly share code, notes, and snippets.

@withlovee
withlovee / rec.html
Last active August 29, 2015 14:25
Rectacgle box using image
<!DOCTYPE html>
<html>
<style>
.x{
background: #ddd;
position: relative;
}
img{
width: 100%;
height: auto;
componentWillReceiveProps: function(nextProps) {
var selectedStyles = {};
console.log(nextProps.styles);
for(i in nextProps.styles){
console.log('style' + i);
var name = this.styleName(nextProps.styles[i].italic, nextProps.styles[i].weight);
console.log(name);
selectedStyles[name] = false;
}
selectedStyles['normal'] = true;
@withlovee
withlovee / LinkedListCycle.py
Created March 14, 2015 01:22
Linked List Cycle
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param head, a ListNode
# @return a boolean
def __init__(self):
@withlovee
withlovee / gist:b3820b30ad5fa1021f3d
Created January 21, 2015 19:06
Get all file names in folder
filelist = []
folderPath = "path goes here"
for (dirpath, dirnames, filenames) in walk(folderPath):
filelist.extend(filenames)
break
//
// main.cpp
// Hand
//
// Created by Nuttapon Pattanavijit on 11/24/14.
// Copyright (c) 2014 nut. All rights reserved.
//
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
using namespace cv;
using namespace std;
int main(){
VideoCapture cap(0);
if (!cap.isOpened()) {
return -1;
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/ml/ml.hpp>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <algorithm>
source('boundary.R')
getDataBD <- function() {
# Condition: Passed if max_bank + 4 and ground_level - 1
# CHI001: Passed (Above right_bank but below left_bank)
# CHI002: Passed (Below both banks)
# KRN001: Below ground level
# KRN002: Above maxbank (left)
# KRN003: Above maxbank (right)
# KRN004: Below negative ground level
code <- c("CHI001","CHI002","KRN001", "KRN002", "KRN003", "KRN004")
@withlovee
withlovee / tracking-car.c
Last active December 24, 2015 17:29
Line-tracking Car
int HIGHSPEED = 150;
int LOWSPEED = 0;
int beforeWhite = 0;
int countWhite = 0;
int soundLength = 100;
void playSound(){
digitalWrite(12, HIGH);
delay(soundLength);
digitalWrite(12, LOW);