This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# coding: utf-8 | |
output = `pmset -g batt` | |
percent_battery = output.match(/\d+\%/).to_s.gsub("%","").to_f | |
empty = '▹' | |
filled = '▸' | |
color_green = '%{[32m%}' | |
color_yellow = '%{[1;33m%}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fireAndIce; | |
fireAndIce = '\nSome say the world will end in fire, \n\nSome say in ice. \n\nFrom what I\'ve tasted of desire \n\nI hold with those who favor fire. \n\nBut if it had to perish twice, \n\nI think I know enough of hate \n\nTo know that for destruction ice \n\nIs also great \n\nAnd would suffice.\n'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//function called with window, document, navigator, and options obj | |
//line numbers preserved, meant for side-by-side reading | |
func is main function | |
callback = [] | |
kill(b) //takes an id and if present removes it from html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hostnameRow = '<tr data-hostname="{{hostname}}"><td><input type="hidden" name="hostnames[]" value="{{hostname}}"/>{{hostname}} <span onclick="removeHostname(\'{{hostname}}\')">Remove</span></td></tr>'; | |
$("#hostnameTable").append(hostnameRow.replace(new RegExp('{{hostname}}', 'g'), hostname)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Migrating to another DB plan in Heroku | |
# Provision new DB plan | |
heroku addons:add heroku-postgresql:basic --remote production | |
heroku pg:wait --remote production | |
# Prevent New Updates | |
heroku maintenance:on --remote production | |
heroku ps:scale worker=0 --remote production |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MyView = Backbone.View.extend({ | |
initialize: function() {}, | |
render: function() { | |
// Put content into the el | |
this.$el.append( /* some HTML */ ); | |
// Put the el onto the page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MyView = Backbone.View.extend({ | |
initialize: function() { | |
//Adding an event here that causes problems: | |
this.model.on('change', this.render, this); | |
}, | |
render: function() { | |
this.$el.append( /* some HTML */ ); | |
$('#content').append(this.el); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="content"> | |
<div>Person Name: Alex</div> | |
<div>Person Name: AlexPerson Name: Ale</div> | |
<div>Person Name: AlexPerson Name: AlePerson Name: Al</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MyView = Backbone.View.extend({ | |
initialize: function() { | |
//el inserted to the page on init, only called once | |
$('#content').append(this.el); | |
this.model.on('change', this.render, this); | |
}, | |
OlderNewer