Skip to content

Instantly share code, notes, and snippets.

View jonataswalker's full-sized avatar
💭
I may be slow to respond.

Jonatas Walker jonataswalker

💭
I may be slow to respond.
View GitHub Profile
@tanabe
tanabe / gist:2918306
Created June 12, 2012 15:45
phantom.js webserver
(function() {
var server = require('webserver').create();
var service = server.listen(9876, function (request, response) {
var fs = require('fs');
var file = fs.read(fs.workingDirectory + request.url);
response.statusCode = 200;
response.headers['Content-Type'] = 'text/html';
response.write(file);
response.close();
});
@bpierre
bpierre / Makefile
Created November 5, 2011 17:34
A Makefile to concatenate / minify my JS Scripts and convert/compress my Stylus (CSS preprocessor) files
# JS files
JS_FINAL = js/project-name-all.js
JS_TARGETS = js/file1.js \
js/file2.js \
js/file3.js
# CSS files
CSS_FINAL = css/project-name-all.css
STYLUS_TARGETS = css/file1.styl \
@cowboy
cowboy / very-small-ie-detect.js
Created August 21, 2010 13:26 — forked from padolsey/gist:527683
Very small IE detect (aka type coersion ftw)
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 6) then:
// ie === 0
// If you're in IE (>=6) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@binarymax
binarymax / LICENSE.txt
Created May 22, 2011 17:27 — forked from 140bytes/LICENSE.txt
Powerset from array
Copyright (c) 2011 Max Lovenheim Irwin, http://binarymax.com
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@alexmcpherson
alexmcpherson / scrape.js
Created September 17, 2012 00:52
Casper.js vimrc scraper
var casper = require("casper").create();
var url = "https://github.com/search?langOverride=VimL&language=&q=vimrc&repo=&type=Repositories&start_value=" + casper.cli.get(0);
var repoLinks = [];
var fileLinks = [];
function getRepoLinks() {
var links = [];
$("div.results .result h2 a").each(function(i,el){
links.push(el.href);
});
@vaibhavtolia
vaibhavtolia / quicksort.js
Last active August 30, 2016 11:51
Quick-Sort in javascript
function quickSort(a, low, high){
if(high > low){
var index = getRandomInt(low,high);
//console.log(low,high,index);
var pivot = a[index];
//console.log("pivot",pivot);
a = partition(a,pivot);
//console.log(a);
quickSort(a,low,index-1);
@nuxodin
nuxodin / easy-console.js
Created December 8, 2016 15:13
Like to write to the console like this "console = xyz" instead of "console.log(xyz)" ?
!(function(){
var original = console;
Object.defineProperty(window, 'console', {
get:function(){
return original;
},
set:function(value){
original.log(value)
}
})
@anthonyshort
anthonyshort / gist:1178298
Created August 29, 2011 12:31
Prefixing with Sass
@mixin border-radius($radius, $prefixes: -moz -webkit -o) {
@each $prefix in $prefixes {
#{$prefix}-border-radius:$radius;
}
border-radius:$radius;
}
#id {
@include border-radius(5px, -moz -webkit);
@dciccale
dciccale / README.md
Last active May 22, 2018 09:14
Cross-browser triggerEvent function done with 127 bytes of JavaScript

triggerEvent

Cross-browser function to trigger DOM events.