Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
my editor
data:text/html,
<style type="text/css">
#e {
position:absolute;
top:0;
right:0;
bottom:0;
left:0;
font-size:16px;
}
</style>
<div id="e"></div>
<script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js"></script>
<script src="http://code.jquery.com/jquery-1.9.0.min.js"></script>
<script>
var myKey="SecretKeyz";
$(document).ready(function(){
var e;
var url = "http://api.openkeyval.org/"+myKey;
$.ajax({
url: url,
dataType: "jsonp",
success: function(data){
e = ace.edit("e");
e.setTheme("ace/theme/tomorrow_night_eighties");
e.getSession().setMode("ace/mode/markdown");
e.setValue(data);
}
});
$("#e").on("keydown", function (b) {
if (b.ctrlKey && 83 == b.which) {
b.preventDefault();
var data = myKey+"="+encodeURIComponent(e.getValue());
$.ajax({
data: data,
url: "http://api.openkeyval.org/store/",
dataType: "jsonp",
success: function(data){
alert("Saved.");
}
});
}
});
});
</script>
@285984303

This comment has been minimized.

Show comment Hide comment
@285984303

285984303 Jan 30, 2013

nice~

nice~

@cfontes

This comment has been minimized.

Show comment Hide comment
@cfontes

cfontes Jan 30, 2013

Nice...

Doing it like this you keep the screen from flashing when the theme is being switched.

And the %s is useful if you want to map this as a searchEngine in Chrome ans use a keyword to launch it from OmniBox

data:text/html,
<style type="text/css"> 
    #e { position:absolute; top:0; right:0; bottom:0; left:0; font-size:16px; } 
</style>
<div id="e">%s</div>

<script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js"></script>
<script src="http://code.jquery.com/jquery-1.9.0.min.js"></script>
<script> 
    var myKey="SecretKeyz"; 
    $(document).ready( 
        function(){ 
            var e = ace.edit("e");
            e.setTheme("ace/theme/twilight");
            e.getSession().setMode("ace/mode/javascript"); 
            var url = "http://api.openkeyval.org/"+myKey; 
            $.ajax({ 
                url: url, 
                dataType: "jsonp", 
                success: 
                    function(data){                         
                        e.setValue(data); 
                    } 
            }); 
            $("#e").on
            ("keydown", function (b) { 
                if (b.ctrlKey && 83 == b.which) { 
                    b.preventDefault(); 
                    var data = myKey+"="+encodeURIComponent(e.getValue()); 
                    $.ajax({ 
                        data: data, 
                        url: "http://api.openkeyval.org/store/", 
                        dataType: "jsonp", 
                        success: function(data){ alert("Saved."); 
                    } 
                }); 
                } 
            }); 
        }
    ); 
</script>´´´

cfontes commented Jan 30, 2013

Nice...

Doing it like this you keep the screen from flashing when the theme is being switched.

And the %s is useful if you want to map this as a searchEngine in Chrome ans use a keyword to launch it from OmniBox

data:text/html,
<style type="text/css"> 
    #e { position:absolute; top:0; right:0; bottom:0; left:0; font-size:16px; } 
</style>
<div id="e">%s</div>

<script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js"></script>
<script src="http://code.jquery.com/jquery-1.9.0.min.js"></script>
<script> 
    var myKey="SecretKeyz"; 
    $(document).ready( 
        function(){ 
            var e = ace.edit("e");
            e.setTheme("ace/theme/twilight");
            e.getSession().setMode("ace/mode/javascript"); 
            var url = "http://api.openkeyval.org/"+myKey; 
            $.ajax({ 
                url: url, 
                dataType: "jsonp", 
                success: 
                    function(data){                         
                        e.setValue(data); 
                    } 
            }); 
            $("#e").on
            ("keydown", function (b) { 
                if (b.ctrlKey && 83 == b.which) { 
                    b.preventDefault(); 
                    var data = myKey+"="+encodeURIComponent(e.getValue()); 
                    $.ajax({ 
                        data: data, 
                        url: "http://api.openkeyval.org/store/", 
                        dataType: "jsonp", 
                        success: function(data){ alert("Saved."); 
                    } 
                }); 
                } 
            }); 
        }
    ); 
</script>´´´
@lovemyliwu

This comment has been minimized.

Show comment Hide comment
@lovemyliwu

lovemyliwu Jan 30, 2013

不错,太nb了

不错,太nb了

@GL8666

This comment has been minimized.

Show comment Hide comment
@GL8666

GL8666 Jan 30, 2013

Awsome~

GL8666 commented Jan 30, 2013

Awsome~

@arbing

This comment has been minimized.

Show comment Hide comment
@arbing

arbing Jan 30, 2013

Nice

<title>TextEditor</title>

arbing commented Jan 30, 2013

Nice

<title>TextEditor</title>
@assassindesign

This comment has been minimized.

Show comment Hide comment
@assassindesign

assassindesign Jan 30, 2013

光打字多无聊来个画图的玩玩:)

data:text/html, <body><canvas id="dyDraw">你的浏览器不支持HTML5 Canvas</canvas></body><script>function $(id){return document.getElementById(id);} $('dyDraw').width=document.body.clientWidth;$('dyDraw').height=document.body.clientHeight;if(window.addEventListener){window.addEventListener('load',function(){var canvas,canvastext;var hua=false;function dyDrawing(){canvas=$('dyDraw');canvastext=canvas.getContext('2d');canvas.addEventListener('mousedown',canvasMouse,false);canvas.addEventListener('mousemove',canvasMouse,false);window.addEventListener('mouseup',canvasMouse,false);} function canvasMouse(dy){var x,y;if(dy.layerX||dy.layerX==0){x=dy.layerX;y=dy.layerY;}else if(dy.offsetX||dy.offsetX==0){x=dy.offsetX;y=dy.offsetY;} x-=dyDraw.offsetLeft;y-=dyDraw.offsetTop;if(dy.type=='mousedown'){hua=false;canvastext.beginPath();canvastext.moveTo(x,y);hua=true;}else if(dy.type=='mousemove'){if(hua){canvastext.strokeStyle="rgb(255,0,0)";canvastext.lineWidth=9;canvastext.lineTo(x,y);canvastext.stroke();}}else if(dy.type=='mouseup'){hua=false;}} dyDrawing();},false);}</script>

光打字多无聊来个画图的玩玩:)

data:text/html, <body><canvas id="dyDraw">你的浏览器不支持HTML5 Canvas</canvas></body><script>function $(id){return document.getElementById(id);} $('dyDraw').width=document.body.clientWidth;$('dyDraw').height=document.body.clientHeight;if(window.addEventListener){window.addEventListener('load',function(){var canvas,canvastext;var hua=false;function dyDrawing(){canvas=$('dyDraw');canvastext=canvas.getContext('2d');canvas.addEventListener('mousedown',canvasMouse,false);canvas.addEventListener('mousemove',canvasMouse,false);window.addEventListener('mouseup',canvasMouse,false);} function canvasMouse(dy){var x,y;if(dy.layerX||dy.layerX==0){x=dy.layerX;y=dy.layerY;}else if(dy.offsetX||dy.offsetX==0){x=dy.offsetX;y=dy.offsetY;} x-=dyDraw.offsetLeft;y-=dyDraw.offsetTop;if(dy.type=='mousedown'){hua=false;canvastext.beginPath();canvastext.moveTo(x,y);hua=true;}else if(dy.type=='mousemove'){if(hua){canvastext.strokeStyle="rgb(255,0,0)";canvastext.lineWidth=9;canvastext.lineTo(x,y);canvastext.stroke();}}else if(dy.type=='mouseup'){hua=false;}} dyDrawing();},false);}</script>
@minikomi

This comment has been minimized.

Show comment Hide comment
@minikomi

minikomi Jan 31, 2013

@assassindesign haha.. sketch pad :)

Owner

minikomi commented Jan 31, 2013

@assassindesign haha.. sketch pad :)

@xrfinbupt

This comment has been minimized.

Show comment Hide comment
@xrfinbupt

xrfinbupt Jan 31, 2013

cool

cool

@suxu

This comment has been minimized.

Show comment Hide comment
@suxu

suxu Jan 31, 2013

@zonesan

This comment has been minimized.

Show comment Hide comment
@zonesan

zonesan Jan 31, 2013

I can ust it to type text, but can not save to a file.

zonesan commented Jan 31, 2013

I can ust it to type text, but can not save to a file.

@decradish

This comment has been minimized.

Show comment Hide comment
@decradish

decradish Feb 1, 2013

WOW!!!

WOW!!!

@meishixiu

This comment has been minimized.

Show comment Hide comment
@meishixiu

meishixiu Feb 3, 2013

强大

强大

@berlino

This comment has been minimized.

Show comment Hide comment
@berlino

berlino Feb 4, 2013

技术宅拯救世界

berlino commented Feb 4, 2013

技术宅拯救世界

@DOXuxi

This comment has been minimized.

Show comment Hide comment
@DOXuxi

DOXuxi Feb 4, 2013

NNNN!!!!!!

DOXuxi commented Feb 4, 2013

NNNN!!!!!!

@inmyfree

This comment has been minimized.

Show comment Hide comment
@inmyfree

inmyfree Feb 5, 2013

cool

inmyfree commented Feb 5, 2013

cool

@ekd123

This comment has been minimized.

Show comment Hide comment
@ekd123

ekd123 Feb 5, 2013

善哉!

ekd123 commented Feb 5, 2013

善哉!

@bingwen

This comment has been minimized.

Show comment Hide comment
@bingwen

bingwen Feb 15, 2013

cool

bingwen commented Feb 15, 2013

cool

@bingwen

This comment has been minimized.

Show comment Hide comment
@bingwen

bingwen Feb 15, 2013

cool

bingwen commented Feb 15, 2013

cool

@houtf

This comment has been minimized.

Show comment Hide comment
@houtf

houtf Feb 17, 2013

牛B

houtf commented Feb 17, 2013

牛B

@lioneltsai

This comment has been minimized.

Show comment Hide comment
@lioneltsai

lioneltsai Feb 20, 2013

拉轰!!

拉轰!!

@wg19891116

This comment has been minimized.

Show comment Hide comment
@wg19891116

wg19891116 Mar 8, 2013

nice

nice

@tylerlong

This comment has been minimized.

Show comment Hide comment
@tylerlong

tylerlong Mar 9, 2013

Now we have Slim Text

Slim Text

Now we have Slim Text

Slim Text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment