Skip to content

Instantly share code, notes, and snippets.

🙈
Typing...

Buti nobuti

🙈
Typing...
Block or report user

Report or block nobuti

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:3496483
# enable git unstaged indicators - set to a non-empty value
GIT_PS1_SHOWDIRTYSTATE="."
# enable showing of untracked files - set to a non-empty value
GIT_PS1_SHOWUNTRACKEDFILES="."
# enable stash checking - set to a non-empty value
GIT_PS1_SHOWSTASHSTATE="."
# enable showing of HEAD vs its upstream
View load.js
function loadScript(path, fn) {
var el = document.createElement('script'),
loaded = 0,
onreadystatechange = 'onreadystatechange',
readyState = 'readyState';
el.onload = el.onerror = el[onreadystatechange] = function () {
if (loaded || (el[readyState] && !(/^c|loade/.test(el[readyState])))) return;
el.onload = el.onerror = el[onreadystatechange] = null;
loaded = 1;
@nobuti
nobuti / gist:3652427
Created Sep 6, 2012
Node.js hello world
View gist:3652427
var http = require('http');
http.createServer(function(req, res){
res.writeHead(200,{'Content-Type':'text/plain'});
res.end('Hello world');
}).listen(8080, '127.0.0.1');
console.log("Node server running at http://localhost:8080");
@nobuti
nobuti / gist:3717748
Created Sep 13, 2012
Sublime text command line
View gist:3717748
ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime
@nobuti
nobuti / gist:3756881
Created Sep 20, 2012
Easy jquery/zepto images preload
View gist:3756881
var images = ["path/to/image", "path/to/image", ... , "path/to/image"],
preloaded = images.length;
_.each(images, function(img) {
var image = $('<img />').attr('src', img);
image.on('load', function(){
preloaded--;
if (preloaded === 0){
console.log("All preloaded!");
}
@nobuti
nobuti / gist:3816985
Created Oct 2, 2012
MySQL tables for continent names, country names and their ISO codes
View gist:3816985
CREATE TABLE IF NOT EXISTS `continents` (
`code` CHAR(2) NOT NULL COMMENT 'Continent code',
`name` VARCHAR(255),
PRIMARY KEY (`code`)
) ENGINE=InnoDB;
INSERT INTO `continents` VALUES
('AF', 'Africa'),
('AS', 'Asia'),
('EU', 'Europe'),
View responsive retina images
@mixin image-2x($image, $width, $height) {
@media (min--moz-device-pixel-ratio: 1.3),
(-o-min-device-pixel-ratio: 2.6/2),
(-webkit-min-device-pixel-ratio: 1.3),
(min-device-pixel-ratio: 1.3),
(min-resolution: 1.3dppx) {
background-image: image-url($image);
background-size: $width $height;
}
View .excludes
# Exclude files that don't need to be on the server
# Used by rsync when deploying code to the server
.excludes
.git
.gitignore
log/
tmp/
@nobuti
nobuti / gist:4662944
Created Jan 29, 2013
Rakefile for small sinatra app, with a task to deploy to Webfaction.
View gist:4662944
require 'rubygems'
require 'bundler'
Bundler.require
require 'rspec/core/rake_task'
ENV['RACK_ENV'] ||= 'development'
task :default => :help
@nobuti
nobuti / gist:9131387
Created Feb 21, 2014
Bidi detection on inputs texts
View gist:9131387
// From http://closure-library.googlecode.com/svn-history/r27/trunk/closure/goog/docs/closure_goog_i18n_bidi.js.source.html
// with modifications
bidi_helpers = (function(){
var module = {}
/**
* Directionality enum.
* @enum {number}
*/
You can’t perform that action at this time.