Skip to content

Instantly share code, notes, and snippets.

View golimpio's full-sized avatar

Gilberto Olimpio golimpio

  • Yackandandah VIC, Australia
  • 22:56 (UTC +10:00)
View GitHub Profile
-- This script automatically `cd`s to the directory of the current document.
-- You can use $f to represent the file for the current document.
-- This is nowhere near perfect, just a quick and dirty script.
-- NOTE: you need to have "Enable access for assistive devices" checked...
-- in the Accessibility preference pane.
-- Example: select a file in Finder, and type: echo The filename is $f
on getCurrentDocument()
@didip
didip / delicious-scraper.py
Created December 17, 2010 23:53
Scrape delicious links using Python
# Requirements:
# - python-lxml
# - pyquery
#
# As implemented in http://mybucket.co
# html_util.py
from pyquery import PyQuery as pq
def extract_delicious_data_from_html(html):
results = []
@tinogomes
tinogomes / gist:749885
Created December 21, 2010 12:37
To downcase all keys and subkeys from a hash
class Hash
def downcase_all_keys
result = self.map do |k,v|
[
k.downcase,
case v.class.name
when "Hash" then v.downcase_all_keys
when "Array" then v.map {|i| i.downcase_all_keys }
else v
end
@helena
helena / CloudExtension.scala
Last active December 21, 2015 00:29
Simple (and truncated) example of the CloudExtension's load-time ordered provisioning and ordered graceful shutdown. Unfortunately this had to be written in an older version of scala and akka - for now. MyNodeGuardian.scala is started in CloudExtension.register() and is a sample of using ProvisioningGuardian which extends OrderedGracefulShutdown.
/**
* CloudExtension and factory for creating CloudExtension instances.
* Example:
* {{{
* val application = CloudExtension(system, config)
* }}}
*
* @author Helena Edelson
*/
object CloudExtension extends ExtensionId[CloudExtension] with ExtensionIdProvider {
@davloperez
davloperez / CustomThemeV2.js
Created August 21, 2015 07:37
Visual Studio Code - customize theme version 2
(function customize_theme(){
// set the custom properties here
// the keys of custom_theme must be css selectors.
// the values of custom_theme must be:
// if the key (css selector) already exist in the Visual Studio Code stylesheet, the value must be an object with css property-values.
// else (if the key doesn't exist yet), the value it must be a string with the inner text of a Css rule.
var custom_theme = {
/*'.monaco-workbench.vs-dark .explorer-viewlet .monaco-tree .monaco-tree-row > .content .explorer-item.folder-icon': { background: 'linear-gradient(to right, rgba(109,109,72,0.42) 0%,rgba(209,211,96,0) 14%)', color: '#B5B580'},*/
'.monaco-workbench.vs-dark .explorer-viewlet .monaco-tree .monaco-tree-row > .content .explorer-item.folder-icon': { color: '#B5B580', 'font-weight': 'bold'},
@reactormade
reactormade / remove-sidebar-folder-icon.sublime-theme
Last active September 25, 2018 23:27
Remove folder icons from sidebar in Sublime Text 3 build 3065
// place this anywhere in a .sublime-theme
{
"class": "icon_file_type",
"content_margin": [0,0]
},
{
"class": "icon_folder",
"content_margin": [0,0]
},
@Arthraim
Arthraim / bottle_example.py
Created May 27, 2011 04:27
a python web framework bottle's example
#coding: utf-8
from bottle import route, error, post, get, run, static_file, abort, redirect, response, request, template
@route('/')
@route('/index.html')
def index():
return '<a href="/hello">Go to Hello World page</a>'
@route('/hello')
def hello():
@pgmccann
pgmccann / styles.less
Created April 17, 2014 08:59
Condensed tree view for http://atom.io. Modify stylesheet using Atom > Open Your Stylesheet.
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed.
*
* If you are unfamiliar with LESS, you can read more about it here:
* http://www.lesscss.org
*/
@unhammer
unhammer / window-toggle-decorations.py
Created February 13, 2012 08:55
toggle gtk window decorations
#! /usr/bin/python2
import gtk.gdk
w = gtk.gdk.window_foreign_new( gtk.gdk.get_default_root_window().property_get("_NET_ACTIVE_WINDOW")[2][0] )
w.set_decorations( (w.get_decorations()+1)%2 ) # toggle between 0 and 1
gtk.gdk.window_process_all_updates()
gtk.gdk.flush()
# now bind this to super-r or something
@kenjij
kenjij / textmate-lineheight.sh
Created August 21, 2015 22:06
Line-height adjustment in TextMate
# This example will make Adobe Source Code Pro font look snug in TextMate.
# Adjust space above the line
defaults write com.macromates.TextMate.preview fontAscentDelta -float -2
# Adjust space below the line
defaults write com.macromates.TextMate.preview fontLeadingDelta -float 0
# Reset to default
defaults delete com.macromates.TextMate.preview fontAscentDelta