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
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
func Newt(x float64) float64 { |
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
const char fragmentShader_yuv420p[] = | |
{ | |
"precision mediump float;\n" | |
"uniform sampler2D Ytex;\n" | |
"uniform sampler2D Utex,Vtex;\n" | |
"varying vec2 vTextureCoord;\n" | |
"void main(void) {\n" | |
" float nx,ny,r,g,b,y,u,v;\n" | |
" mediump vec4 txl,ux,vx;" | |
" nx=vTextureCoord[0];\n" |
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
// gmt time string from server | |
NSString *gmtDateString = @"08/12/2013 21:01"; | |
NSDateFormatter *df = [NSDateFormatter new]; | |
[df setDateFormat:@"dd/MM/yyyy HH:mm"]; | |
df.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0]; | |
NSDate *date = [df dateFromString:gmtDateString]; | |
//Create a date string in the local timezone | |
df.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:[NSTimeZone localTimeZone].secondsFromGMT]; |
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
public void onCreateView (LayoutInflater inflater, ViewGroup container, | |
Bundle savedInstanceState) { | |
// enable options menus | |
setHasOptionsMenu(true); | |
} | |
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { | |
super.onCreateOptionsMenu(menu, inflater); | |
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
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); |
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
private Runnable mLoop = new Runnable() { | |
@Override | |
public void run() { | |
UsbDevice dev = sDevice; | |
if (dev == null) | |
return; | |
UsbManager usbm = (UsbManager) getSystemService(USB_SERVICE); | |
UsbDeviceConnection conn = usbm.openDevice(dev); | |
l("Interface Count: " + dev.getInterfaceCount()); |
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
package wcy.leetcode.gist; | |
import java.util.LinkedList; | |
/** | |
* Created by ChauyanWang on 12/20/14. | |
*/ | |
public class Path_Sum { | |
class TreeNode { | |
TreeNode left; |
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
package wcy.leetcode.gist; | |
/** | |
* Created by ChauyanWang on 12/20/14. | |
*/ | |
public class Valid_Palindrome { | |
public boolean Solution (String s) { | |
if( s == null || s.length() == 0) return true; | |
s = s.toLowerCase(); | |
int start = 0; |
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
package wcy.leetcode.gist; | |
/** | |
* Created by ChauyanWang on 12/20/14. | |
*/ | |
public class Longest_Common_Prefix { | |
int findMinLength(String[] strs) { | |
int minLength = Integer.MAX_VALUE; | |
for(String str : strs) { |
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
package wcy.leetcode.gist; | |
/** | |
* Created by ChauyanWang on 12/20/14. | |
*/ | |
public class romanToInt { | |
int getInteger(char c) { | |
switch (c) { | |
case 'i': return 1; | |
case 'v': return 5; |