Skip to content

Instantly share code, notes, and snippets.

View hallison's full-sized avatar
😊
I may be slow to respond.

Hallison Batista hallison

😊
I may be slow to respond.
View GitHub Profile
@edsono
edsono / skel.vim
Created June 16, 2011 19:53
Create new files from template
" Vim global plugin for creating files from templates
" Last Change: 15/06/2011
" Maintainer: Edson César <edsono@gmail.org>
" License: This file is placed in the public domain.
function! s:Skel(template, filename)
if !empty(fnamemodify(a:filename, ":e"))
let l:fn = a:filename
else
let l:fn = a:filename . "." . fnamemodify(a:template, ":e")
# An example Jekyll generator. Utilizes the new plugin system.
#
# 1. Make a _plugins directory in your jekyll site, and put this class in a file there.
# 2. Upon site generation, version.html will be created in your root destination with
# # the version of Jekyll that generated it
module Jekyll
class VersionReporter < Generator
safe true
@EtienneLem
EtienneLem / Rakefile
Created October 18, 2012 15:27
Sinatra (javascript|stylesheet)_include_tag helper w/ Rakefile tasks
namespace :assets do
# `bundle exec rake assets:compile`
# * Compile stylesheets and javascripts
desc 'compile assets'
task :compile => [:compile_css, :compile_js] do
end
# `bundle exec rake assets:compile_css`
# IN => /app/assets/stylesheets/styles.styl
# OUT => /public/css/styles-<version>.min.css
@statico
statico / gist:3172711
Created July 24, 2012 21:15
How to use a PS3 controller on Mac OS X 10.7 (Lion)

How to use a PS3 controller on Mac OS X 10.7 (Lion)

  1. Open Apple menu -> System Preferences -> Bluetooth and disable Bluetooth on Mac as well as any other nearby Macs or devices which will try to pair with and confuse the controller.

  2. Reset PS3 controller by inserting paperclip into pinhole near L2 button.

  3. Connect PS3 controller to Mac with USB cable.

  4. Enable Bluetooth.

@rkh
rkh / chat.rb
Created December 14, 2011 12:55
Simple Chat Application using the Sinatra Streaming API
# coding: utf-8
require 'sinatra'
set server: 'thin', connections: []
get '/' do
halt erb(:login) unless params[:user]
erb :chat, locals: { user: params[:user].gsub(/\W/, '') }
end
get '/stream', provides: 'text/event-stream' do
@mateusg
mateusg / inflections.rb
Created April 17, 2011 23:03
pt-BR inflections file for Ruby on Rails applications
# encoding: utf-8
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
@mytharcher
mytharcher / compressor.rb
Last active May 10, 2022 01:56
A jekyll plugin for compressing HTML, JavaScript files when rendering.
#
# File compressor plugin for jekyll
# =================================
#
# By [mytharcher](https://github.com/mytharcher)
# 2012-05-20
#
# Updated by [nicoespeon](https://github.com/nicoespeon)
# 2013-04-12
#
@harryi3t
harryi3t / update-slack-status-on-lock-events
Created January 10, 2017 10:59
set the slack status as away on screen lock and back to active on screen unlock
#/bin/bash
TOKEN='put your token here. Get a new from https://api.slack.com/docs/oauth-test-tokens'
dbus-monitor --session type='signal',interface='com.canonical.Unity.Session' | while true
do
read x
if echo "$x" | grep -q Locked; then
echo "set yourself away at $(date)"
curl -X GET -H "Cache-Control: no-cache" "https://slack.com/api/users.setPresence?token=$TOKEN&presence=away"
@runemadsen
runemadsen / app.rb
Created October 17, 2012 13:45
Sinatra File Upload
require 'sinatra'
get "/" do
erb :form
end
post '/save_image' do
@filename = params[:file][:filename]
file = params[:file][:tempfile]
@cowboy
cowboy / ba-smallwalker.js
Created May 5, 2011 21:27
Small Walker: A small and simple JavaScript DOM walker
/*!
* Small Walker - v0.1.1 - 5/5/2011
* http://benalman.com/
*
* Copyright (c) 2011 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
// Walk the DOM, depth-first (HTML order). Inside the callback, `this` is the