Skip to content

Instantly share code, notes, and snippets.

View xcv58's full-sized avatar
๐Ÿ˜€
What's happening?

xcv58 xcv58

๐Ÿ˜€
What's happening?
View GitHub Profile
@xcv58
xcv58 / prime.py
Created September 23, 2016 14:35
def is_prime(n):
for i in range(2, n/ 2 + 1):
if n % i is 0:
return False
return True
print [i for i in range(2, 100) if is_prime(i)]
// Fetch a SQL string from a jOOQ Query in order to manually execute it with another tool.
// For simplicity reasons, we're using the API to construct case-insensitive object references, here.
String sql = create.select(field("BOOK.TITLE"), field("AUTHOR.FIRST_NAME"), field("AUTHOR.LAST_NAME"))
.from(table("BOOK"))
.join(table("AUTHOR"))
.on(field("BOOK.AUTHOR_ID").equal(field("AUTHOR.ID")))
.where(field("BOOK.PUBLISHED_IN").equal(1948))
.getSQL();
@xcv58
xcv58 / main.go
Created February 12, 2016 17:40
Go http get example
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
resp, err := http.Get("https://www.ops-class.org/")
public class Solution {
private int[][] dp;
public boolean isInterleave(String s1, String s2, String s3) {
if (s1.length() + s2.length() != s3.length()) {
return false;
}
if (s3.length() == 0) {
return true;
}
dp = new int[s1.length()][s2.length()];
@xcv58
xcv58 / LeetCode-Instant-Search.js
Created November 11, 2015 22:59
Instant search for LeetCode
$('#searchText').on('input propertychange paste', function() {
$(this).trigger(jQuery.Event('keyup', {which: 13, keyCode: 13}));
});
customjsReady('.icon-hide-conversation', function(element) {
element.click();
});
@xcv58
xcv58 / test
Last active October 28, 2015 00:16
test
console.log('Hello');
@xcv58
xcv58 / ready.js
Created October 27, 2015 23:07
MutationObserver
(function(win){
'use strict';
var listeners = [],
doc = win.document,
MutationObserver = win.MutationObserver || win.WebKitMutationObserver,
observer;
function ready(selector, fn){
// Store the selector and callback to be monitored
listeners.push({
@xcv58
xcv58 / quip-auto-hide-sidebar.js
Last active October 27, 2015 23:07
Quip auto hide sidebar
// inspired by http://ryanmorr.com/using-mutation-observers-to-watch-for-element-availability/
(function(win){
'use strict';
var listeners = [],
doc = win.document,
MutationObserver = win.MutationObserver || win.WebKitMutationObserver,
observer;
function ready(selector, fn){
// Store the selector and callback to be monitored
@xcv58
xcv58 / build.gradle
Last active August 31, 2015 21:38
dependsOn and overwrite conflict
task a << {
println 'task a'
}
task b(dependsOn: {a}) << { // works
// task b(dependsOn: 'a') << { // works
// task b(dependsOn: [a]) << { // doesn't work
// task b(dependsOn: a) << { // doesn't work
// task b << {
println 'task b'