Skip to content

Instantly share code, notes, and snippets.

View mbigras's full-sized avatar

Max Bigras mbigras

View GitHub Profile
@zxaos
zxaos / Cycle Karabiner Elements Profiles.alfredworkflow
Last active June 7, 2017 18:37
Cycle Karabiner-Elements profiles with Alfred
@kenzie
kenzie / wrap-erb-tags.sublime-snippet
Created May 25, 2012 15:13
Sublime Text 2 snippet for wrapping selection in erb tags
<snippet>
<content><![CDATA[
<%= ${0:$TM_SELECTED_TEXT} %>
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<!-- <tabTrigger>hello</tabTrigger> -->
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.erb</scope> -->
<description>&lt;%= … %&gt;</description>
@l0gicpath
l0gicpath / all_users.csv
Last active November 11, 2017 13:59
Subtract data of one CSV file from another using fast grep. Dummy data generated by http://dummydata.me/
jame@out.org Stefanie House
dolores.bernice@roofroom.me Dinah Erickson
luke.homer.gerard@smile.info Melisa Reynolds
salvador.perry@selectionself.info Lily Carson
rich.jamel@cover.me Millard Rubio
benita@rangerat.edu Octavia Santana
vickie.mattie@westwet.info Royal Bender
dwayne@part.me Laverne Hutchins
jeanette.laurie.katie@light.me Sherman Wilder
jami.elnora@smokesmooth.edu Thelma Burris
@shageman
shageman / bar.rake
Created February 8, 2012 02:08
Testing rake tasks
File: lib/tasks/bar.rake
class BarOutput
def self.banner text
puts '*' * 60
puts " #{text}"
puts '*' * 60
end
def self.puts string
puts string
@satyrius
satyrius / exercise-44.go
Created October 23, 2013 06:25
A Tour of Go. Exercise: Fibonacci closure. Let's have some fun with functions. Implement a fibonacci function that returns a function (a closure) that returns successive fibonacci numbers.
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
var a, b int
return func() int {
a, b = b, a + b
@tilusnet
tilusnet / parse_toc.py
Last active March 2, 2020 10:13 — forked from sakti/parse_toc.py
#!/usr/bin/env python
# parse_toc.py
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
def parse(filename, maxlevel):
fp = open(filename, 'rb')
parser = PDFParser(fp)
doc = PDFDocument(parser)
@samstokes
samstokes / regex-groups-global.rb
Created November 18, 2009 03:28
How to extract groups from a regex match in Ruby without globals or temporary variables. Code snippets supporting http://blog.samstokes.co.uk/post/251167556/regex-style-in-ruby
if "foo@example.com" =~ /@(.*)/
$1
else
raise "bad email"
end
# => "example.com"
@math2001
math2001 / minimap_setting.py
Last active August 14, 2021 17:34
A plugin to hide the minimap using a setting on sublime text.
# -*- encoding: utf-8 -*-
import sublime
import sublime_plugin
class MinimapSetting(sublime_plugin.EventListener):
def on_activated(self, view):
show_minimap = view.settings().get('show_minimap')
if show_minimap:
@SabretWoW
SabretWoW / json_response_handling_ruby.rb
Created December 11, 2013 14:20
Ruby script that uses open-uri to fetch the contents of a JSON endpoint, uses the JSON gem to parse the string into a Ruby array & prints some of the records. This is the foundation for all web API requests, so feel free to use it in the future.
# http://ruby-doc.org/stdlib-2.0.0/libdoc/open-uri/rdoc/OpenURI.html
require 'open-uri'
# https://github.com/flori/json
require 'json'
# http://stackoverflow.com/questions/9008847/what-is-difference-between-p-and-pp
require 'pp'
# Construct the URL we'll be calling
request_uri = 'http://localhost:3000/users.json'
request_query = ''
@bignimbus
bignimbus / .vimrc
Last active October 12, 2022 11:19
Set iTerm2 title to current buffer in vim
" Set the title of the Terminal to the currently open file
function! SetTerminalTitle()
let titleString = expand('%:t')
if len(titleString) > 0
let &titlestring = expand('%:t')
" this is the format iTerm2 expects when setting the window title
let args = "\033];".&titlestring."\007"
let cmd = 'silent !echo -e "'.args.'"'
execute cmd
redraw!