Skip to content

Instantly share code, notes, and snippets.

View jcubic's full-sized avatar
🎯
Focusing

Jakub T. Jankiewicz jcubic

🎯
Focusing
View GitHub Profile
@jcubic
jcubic / dabblet.css
Last active October 11, 2015 02:57
Center text
.wrapper {
clear: both;
margin: 0 10px;
background: red;
float: left;
width:100%;
}
.wrapper .block {
text-align: left;
width: 25%;
@jcubic
jcubic / init.java
Last active December 30, 2019 15:42
Reflection based JSON-RPC Servlet
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.lang.reflect.*;
import com.thetransactioncompany.jsonrpc2.*;
public class init extends HttpServlet {
public init() {
@jcubic
jcubic / dabblet.css
Created January 29, 2014 19:01
CSS3 Pagniation
body {
background: #222;
}
.arrow {
background-color: white;
transform: rotate(45deg);
position: absolute;
top: 50%;
}
.arrow, .arrow:before {
@jcubic
jcubic / foo.js
Created March 14, 2014 08:24
indent test file for web-mode
(function() {
// }
function() { //
foo();
bar();
}
baz();
})();
@jcubic
jcubic / keybase.md
Created August 15, 2014 07:56
Kebase.io proof

Keybase proof

I hereby claim:

  • I am jcubic on github.
  • I am jcubic (https://keybase.io/jcubic) on keybase.
  • I have a public key whose fingerprint is BC65 3F92 314B 398B 5E1E 0BC7 A58E E6F1 31F8 3013

To claim this, I am signing this object:

@jcubic
jcubic / browser.js
Last active August 29, 2015 14:05
MVVM demo with route.js, jsViews, jQuery and hashchange
(function() {
var matched, browser;
// Use of jQuery.browser is frowned upon.
// More details: http://api.jquery.com/jQuery.browser
// jQuery.uaMatch maintained for back-compat
jQuery.uaMatch = function( ua ) {
ua = ua.toLowerCase();
@jcubic
jcubic / findText.js
Last active February 19, 2016 22:35
findText function
function findText( rootElement, textToFind ) {
var walker = document.createTreeWalker( rootElement,
NodeFilter.SHOW_TEXT,
null,
false );
var texts = [],
nodes = [];
walker.firstChild();
nodes.push( walker.currentNode );
@jcubic
jcubic / escape.js
Created May 18, 2016 15:07
Escape String as per EcmaScript spec
/*
* implementation of the alorithm from EcmaScript spec in section 15.1.2.4
* http://www.ecma-international.org/publications/files/ECMA-ST-ARCH/ECMA-262,%201st%20edition,%20June%201997.pdf
*/
(function(global) {
var allowed = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./,';
global.escapeString = function(str) {
str = str.toString();
var len = str.length, R = '', k = 0, S, chr, ord;
while(k < len) {
@jcubic
jcubic / cross-domain.js
Last active December 10, 2018 20:34
Cross domain ajax request without CORS using iframe and postMessage
$.fn.crossDomainRequest = function(url, method, data, fn) {
var self = this;
var receiver = self.attr('src').replace(/\/.*$/, '').replace(/^https?::\/\//, '');
function get(event) {
if (event.origin.match(receiver)) {
// event.data is response from POST
fn(event.data);
}
}
if (window.addEventListener){
@jcubic
jcubic / jquery.terminal-src.js
Created September 2, 2016 16:12
Development version of jQuery Terminal without content editable
/**@license
* __ _____ ________ __
* / // _ /__ __ _____ ___ __ _/__ ___/__ ___ ______ __ __ __ ___ / /
* __ / // // // // // _ // _// // / / // _ // _// // // \/ // _ \/ /
* / / // // // // // ___// / / // / / // ___// / / / / // // /\ // // / /__
* \___//____ \\___//____//_/ _\_ / /_//____//_/ /_/ /_//_//_/ /_/ \__\_\___/
* \/ /____/ version {{VER}}
*
* This file is part of jQuery Terminal. http://terminal.jcubic.pl
*