Skip to content

Instantly share code, notes, and snippets.

View uhtred's full-sized avatar

Daniel França uhtred

View GitHub Profile
@timoxley
timoxley / isPortTaken.js
Last active April 19, 2024 11:51
check if a port is being used with nodejs
var isPortTaken = function(port, fn) {
var net = require('net')
var tester = net.createServer()
.once('error', function (err) {
if (err.code != 'EADDRINUSE') return fn(err)
fn(null, true)
})
.once('listening', function() {
tester.once('close', function() { fn(null, false) })
.close()
@oodavid
oodavid / README.md
Last active June 12, 2024 00:28 — forked from aronwoost/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@psebborn
psebborn / countCSSRules.js
Last active April 25, 2023 11:43
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
@dariusk
dariusk / amazonlogin.js
Created November 14, 2012 14:39
Logging in to Amazon using PhantomJS
// phantomjs code to log in to Amazon
// based on the code from this Stackoverflow answer: http://stackoverflow.com/questions/9246438/how-to-submit-a-form-using-phantomjs
// I'm injecting jQuery so this assumes you have jquery in your project directory
var page = new WebPage(), testindex = 0, loadInProgress = false;
page.onConsoleMessage = function(msg) {
console.log(msg);
};
@uhtred
uhtred / trackLeilao.js
Created November 29, 2012 22:56
AutoBets: Mukirana
// Mukirana.com.br
// @example TrackMukirana.start({ max_price: 'R$ 30,00', interval: 500, auction_id: '', seconds_limit: '02', bets_limit: 20, debug: true });
var TrackMukirana = (function(){
var auction_id = '',
tmpTrack,
betData = {},
trackOptions = {},
bets = 0,
user = 'drfranca';
anonymous
anonymous / index.html
Created January 17, 2013 18:41
A CodePen by Anonymous. Twitter Card - Enter in your username and make your own card, while it lasts...! ** Because of Twitter's lame rate limiting, this demo can only handle 150 people making their own cards per hour... If you try typing your username in and it ain't working, there really isn't much I can do. Try forking this pen. *** Follow me…
<section class="input-container">
<h2>Make your own</h2>
<b>@</b><input placeholder="bennettfeely" id="input" /><button id="create">Create my card</button>
</section>
<section id="card" class="card">
<aside class="prof">
<div class="twitter-icon"></div>
</aside>
<aside class="prof"></aside>
@magnetikonline
magnetikonline / README.md
Last active March 14, 2024 22:48
IE 7/8/9/10/11 Virtual machines from Microsoft - Linux w/VirtualBox installation notes.
@tableless
tableless / gist:5571702
Created May 13, 2013 21:32
Esse código deixa o texto um pouco mais legível e bem acabado nos browsers, melhorando a leitura e a visualização de letras.
body {
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
-ms-font-smoothing: antialiased;
font-smoothing: antialiased;
-moz-text-shadow: 0 0 1px rgba(0, 0, 0, 0.01);
-ms-text-shadow: 0 0 1px rgba(0, 0, 0, 0.01);
text-shadow: 0 0 1px rgba(0, 0, 0, 0.01);
@ricardobarantini
ricardobarantini / README.md
Last active April 24, 2024 18:00
Hack para centralizar div do Bootstrap

Modo de usar

Bootstrap 3

Basta chamar a classe "centered" nas divs com a classe "col-lg-", "col-md-", "col-sm-" ou "col-xs-" (1-12).

@dfkaye
dfkaye / js-get-fn-name.js
Last active October 31, 2022 11:44
get a javascript function name
function getFnName(fn) {
fn = Object(fn)
var F = typeof fn == 'function'
var N = fn.name
var S = F && ((N && ['', N]) || fn.toString().match(/function ([^\(]+)/))
return (!F && 'not a function') || (S && S[1] || 'anonymous');
}
console.log(getFnName(String)); // 'String'
console.log(getFnName(function test(){})); // 'test'