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
def subsets(s, k) | |
max = 1 << s.length | |
allsubsets = [] | |
(0..max).each do |i| | |
subset = [] | |
ii = i | |
index = 0 | |
while ii > 0 | |
if ii & 1 > 0 | |
subset << s[index] |
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
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" |
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
import sublime, sublime_plugin | |
import os, sys | |
import thread | |
import subprocess | |
import functools | |
import time | |
class ProcessListener(object): | |
def on_data(self, proc, data): | |
pass |
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
import sublime, sublime_plugin | |
import os | |
import tempfile | |
class HandlebarsOnSave(sublime_plugin.EventListener): | |
def on_post_save(self, view): | |
folder_name, file_name = os.path.split(view.file_name()) | |
extension = file_name[-3:] | |
if extension == 'hbs': | |
view.window().run_command('exec', { 'cmd': 'export PATH=/usr/local/bin:$PATH; /usr/local/share/npm/bin/grunt', 'shell': True, 'quiet': True}) |
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
@media screen { | |
body { | |
width: 75%; | |
} | |
} | |
@media print { | |
body { | |
width: 100%; | |
} |
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 generateRandomBoxes = function() { | |
var $doc = $(".container"); | |
var $bareBox = $("<div class='box' style='position:absolute; border:1px solid black; width:50px;'></div>"); | |
var maxHeight = 200; | |
var height, | |
$box; | |
for (var i = 0; i < 100; i++) { | |
height = Math.floor(Math.random() * maxHeight); | |
$box = $bareBox.clone().css('height', height + 'px') |
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
import sublime, sublime_plugin | |
import os | |
import tempfile | |
import subprocess | |
class SCPOnSave(sublime_plugin.EventListener): | |
def on_post_save(self, view): | |
folder_name, file_name = os.path.split(view.file_name()) | |
file_path = folder_name + '/' + file_name | |
command = 'scp ' + file_path + ' <URL HERE>:' + file_path + ' > /dev/null' |
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
{ type: 'Program', | |
body: | |
[ { type: 'VariableDeclaration', | |
declarations: | |
[ { type: 'VariableDeclarator', | |
id: { type: 'Identifier', name: 'obj', range: [ 4, 7 ] }, | |
init: | |
{ type: 'ObjectExpression', | |
properties: | |
[ { type: 'Property', |
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
package main | |
import ( | |
"fasta" | |
"fmt" | |
) | |
func main() { | |
fastaFile := fasta.NewFastaFile("cons.txt") |
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
package main | |
import ( | |
"fasta" | |
"fmt" | |
"strings" | |
) | |
func main() { | |
fastaFile := fasta.NewFastaFileWithPath("orf.txt") |