Skip to content

Instantly share code, notes, and snippets.

View sebastialonso's full-sized avatar

Sebastián González sebastialonso

View GitHub Profile
@hastebrot
hastebrot / list_plugins.rb
Created November 12, 2011 23:22
OpenJUMP 1.4.2 Plugin List
import "com.vividsolutions.jump.workbench.ui.AttributeTab"
import "com.vividsolutions.jump.workbench.ui.LayerViewPanel"
workbench_frame = $wc.workbench.frame
menu_bar = workbench_frame.get_jmenu_bar()
tool_bar = workbench_frame.get_tool_bar() # as JToolBar
layer_name_popup_menu = workbench_frame.get_layer_name_popup_menu()
category_popup_menu = workbench_frame.get_category_popup_menu()
@scottwb
scottwb / application_controller.rb
Created February 17, 2012 06:12
Get a list of all the filters on a given Rails 3 controller.
# Add these methods to your ApplicationController. Then, any controller
# that inherits from it will have these methods and can programmatically
# determine what filters it has set.
class ApplicationController < ActionController::Base
def self.filters(kind = nil)
all_filters = _process_action_callbacks
all_filters = all_filters.select{|f| f.kind == kind} if kind
all_filters.map(&:filter)
end
@pamelafox
pamelafox / phonegap-photofetcher.js
Created March 23, 2012 18:32
PhoneGap Convert Photo File URI to Data URI
function getPhoto() {
navigator.camera.getPicture(onPhotoSuccess, onPhotoFail,
{quality: 70, targetWidth: 500, targetHeight: 500,
sourceType: navigator.camera.SourceType.PHOTOLIBRARY,
destinationType: navigator.camera.DestinationType.FILE_URI,
});
}
function onPhotoSuccess(imageUri) {
var $img = $('<img/>');
@christiannelson
christiannelson / 0.config
Created November 26, 2012 00:08
Using HAProxy with Node.js, Socket.io and SSL
global
nbproc 1
maxconn 65536
defaults
timeout connect 5s
timeout queue 5s
timeout server 30s
timeout tunnel 1h
@heldrida
heldrida / javascript
Last active March 11, 2024 17:00
Facebook Javascript SDK: Basic Login and Logout example
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId: 'xxxxxxxxxxxxx',
status: true,
cookie: true,
xfbml: true
});
# Ignore bundler config
/.bundle
/vendor/bundle/
/vendor/ruby/
# Ignore the default database.
/db/*.sqlite3
/db/*.javadb/
# Ignore all logfiles and tempfiles.
@ungoldman
ungoldman / curl_post_json.md
Last active May 2, 2024 15:41
post a JSON file with curl

How do you POST a JSON file with curl??

You can post a json file with curl like so:

curl -X POST -H "Content-Type: application/json" -d @FILENAME DESTINATION

so for example:

@tony612
tony612 / arcanist_cheatsheet.md
Last active July 7, 2023 05:29 — forked from sekimura/gist:6367366
arcanist cheatsheet
  • create tasks T{NNNN} asign them
  • create a branch with name like "T{NNNN}-boo-hoo"
  • git checkout -b T1234-boo-foo
  • commit changes on that branch until it gets ready to be reviewed
  • git commit -am 'first'
  • git commit -am 'now it works'
  • check if it's lint free (NOTE: it runs lint against only modified files)
  • arc lint
  • push a review request to the server. This will create a diff with id D{NNNN}
  • arc diff
@wdullaer
wdullaer / install.sh
Last active April 2, 2024 20:33
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@kwmiebach
kwmiebach / pytest.md
Last active April 28, 2024 22:34 — forked from amatellanes/pytest.sh
pytest cheat sheet

Usage

(Create a symlink pytest for py.test)

pytest [options] [file_or_dir] [file_or_dir] ...

Help: