Skip to content

Instantly share code, notes, and snippets.

View kevzettler's full-sized avatar

kev zettler kevzettler

View GitHub Profile
var xhr = $.ajax({ url : "./"});
xhr._onreadystatechange = xhr.onreadystatechange;
xhr.onreadystatechange = function() {
xhr._onreadystatechange();
if (xhr.readyState == 3){alert('Interactive');}
};
@kevzettler
kevzettler / gist:846662
Created February 27, 2011 22:59
messy js
function crm(req,res,cb){
var post_body = "name="+encodeURIComponent(req.body.username)+"&password="+encodeURIComponent(req.body.password);
request({
method : "GET"
,uri: "http://admin:CREm@localhost.com/admin/login/login"
}, function(error, get_response, body){
jsdom.env(body, [
'http://code.jquery.com/jquery-1.5.min.js'
], function(errors, window) {
@kevzettler
kevzettler / gist:846663
Created February 27, 2011 23:00
manageable js
function crm(req,res,cb){
var post_body = "name="+encodeURIComponent(req.body.username)+"&password="+encodeURIComponent(req.body.password);
function getRequestParams(){
return {
method : "GET"
,uri: "http://admin:CREm@localhost.com/admin/login/login"
};
}
@kevzettler
kevzettler / gist:1331223
Created November 1, 2011 17:14
export_error
Started GET "/admin/current_site/edit" for 97.95.63.213 at 2011-11-01 17:12:38 +0000
Processing by Admin::CurrentSiteController#edit as HTML
[LocomotiveCMS] [fetch site] host = wandering-katana-74.bushi.do / wandering-katana-74.bushi.do
Rendered app/cells/admin/sub_menu/show.html.haml (2.8ms)
Rendered admin/current_site/_form.html.haml (128.4ms)
Rendered admin/shared/_form_actions.html.haml (3.3ms)
Rendered admin/shared/_head.html.haml (1.1ms)
Rendered app/cells/admin/global_actions/show.html.haml (0.8ms)
Rendered admin/shared/_header.html.haml (4.0ms)
Rendered app/cells/admin/main_menu/show.html.haml (1.0ms)
@kevzettler
kevzettler / gist:2199046
Created March 25, 2012 19:00
default validation
<form action="/" method="post" id="form" class="validate[required,funcCall[checkDefault]]">
<input type="submit" value="submit" />
</form>
<script type="text/javascript">
/*
* Awesome helper function for validationEngine
* great for use with autobox
* checkes that a field is not the default value before submitting
*/
99-113-38-75:hubot-kandan-app kevisazombie$ git clone https://github.com/cloudfuji/hubot-kandan-app.git
Cloning into hubot-kandan-app...
remote: Counting objects: 468, done.
remote: Compressing objects: 100% (371/371), done.
remote: Total 468 (delta 48), reused 455 (delta 35)
Receiving objects: 100% (468/468), 686.09 KiB | 434 KiB/s, done.
Resolving deltas: 100% (48/48), done.
99-113-38-75:hubot-kandan-app kevisazombie$ cd hubot-kandan-app
99-113-38-75:hubot-kandan-app kevisazombie$
99-113-38-75:hubot-kandan-app kevisazombie$ # Install the dependencies and scripts
@kevzettler
kevzettler / dancer SSE
Created April 1, 2013 23:22
dancer SSE example
get '/stream' => sub{
content_type 'text/event-stream';
header 'Cache-Control' => 'no-cache';
header 'Connection' => 'Keep-Alive';
return "data: Hello World \n\n";
};
@kevzettler
kevzettler / filepicker bmp
Created April 2, 2013 19:42
filepicker convert bmps
filepicker.pick(function(FPFile){
if (FPFile.mimetype == "image/bmp"){
filepicker.convert(FPFile, {format:'jpg'}, function(conv){
// save_to(conv);
})
} else {
// save_to(FPFile);
}
});
@kevzettler
kevzettler / gist:11384188
Last active August 29, 2015 14:00
JS Assign
  • Look at the following code. What does it do? What happens if you click on the li elements?
  • Establish what happens when you click on the li elements. Why does this happen?.
  • how can the code can be fixed so that it has the expected behavior
<html>
  <body>
    <ul>
     <li>First</li>
 Second
@kevzettler
kevzettler / gist:6baf208a73f16a2974f5
Last active August 29, 2015 14:02
keeperll clang
nknown542696d2a12b:keeperrl kevzettler$ make -j 8 OPT=true
g++ -MMD -Wall -std=c++0x -stdlib=libc++ -static-libstdc++ -Wno-sign-compare -Wno-unused-variable -I /usr/local/Cellar/boost/1.55.0/include/boost/ -I. -I./extern -static-libstdc++ -g -O3 -c time_queue.cpp -o obj-opt/time_queue.o
g++ -MMD -Wall -std=c++0x -stdlib=libc++ -static-libstdc++ -Wno-sign-compare -Wno-unused-variable -I /usr/local/Cellar/boost/1.55.0/include/boost/ -I. -I./extern -static-libstdc++ -g -O3 -c level.cpp -o obj-opt/level.o
g++ -MMD -Wall -std=c++0x -stdlib=libc++ -static-libstdc++ -Wno-sign-compare -Wno-unused-variable -I /usr/local/Cellar/boost/1.55.0/include/boost/ -I. -I./extern -static-libstdc++ -g -O3 -c model.cpp -o obj-opt/model.o
g++ -MMD -Wall -std=c++0x -stdlib=libc++ -static-libstdc++ -Wno-sign-compare -Wno-unused-variable -I /usr/local/Cellar/boost/1.55.0/include/boost/ -I. -I./extern -static-libstdc++ -g -O3 -c square.cpp -o obj-opt/square.o
g++ -MMD -Wall -std=c++0x -stdlib=libc++ -static-libstdc++ -Wno-sign-compare