Skip to content

Instantly share code, notes, and snippets.

View juliobetta's full-sized avatar
🎧

Julio Betta juliobetta

🎧
View GitHub Profile
@juliobetta
juliobetta / NoVNC_Paste.js
Created December 12, 2017 12:12 — forked from byjg/NoVNC_Paste.js
How to Paste code to NoVNC.
// This will open up a prompt for text to send to a console session on digital ocean
// Useful for long passwords
(function () {
window.sendString = function (str) {
f(str.split(""));
function f(t) {
var character = t.shift();
var i=[];
var code = character.charCodeAt();
var needs_shift = character.match(/[A-Z!@#$%^&*()_+{}:\"<>?~|]/);
@juliobetta
juliobetta / Timeline.jsx
Created August 6, 2016 18:19
Timeline element for React toolbox
import React from 'react';
import compose from 'recompose/compose';
import classNames from 'classnames';
import styles from './styles.scss';
import pure from 'recompose/pure';
const Timeline = ({className, children}) => {
const classes = classNames(className, styles.timeline);
return (<div className={classes}>{children}</div>);
};
@juliobetta
juliobetta / gist:6dbf240036fd75e03fcd1ce19aadb060
Created June 3, 2016 19:55 — forked from badsyntax/gist:4330899
Googe places autocomplete implementation using Twitter bootstrap typeahead and google's autocomplete and geocoding services
/**
* Author: Richard Willis - badsyntax.co
* Example here: http://demos.badsyntax.co/places-search-bootstrap/example.html
*
* Please note: This is not a reliable method of geocoding the address. Using the
* PlacesService is a much better approach. View the example above for an example
* of using the PlacesService to geocode the address.
*/
var service = new google.maps.places.AutocompleteService();
@juliobetta
juliobetta / zsh.md
Last active March 11, 2016 00:52 — forked from tsabat/zsh.md

Prereq:

apt-get install zsh
apt-get install git-core

Getting zsh to work in ubuntu is weird, since sh does not understand the source command. So, you do this to install zsh

wget --no-check-certificate http://install.ohmyz.sh -O - | sh

describe 'App.HeaderModule', ->
beforeEach ->
@headerModule = window.App.HeaderModule
it 'should exist', ->
expect(@headerModule).not.toBeUndefined()
describe 'starting', ->
var Utils = {
/* modified version of https://gist.github.com/1243697
* adds detection of file extension rather than hard-coding .jpg as in the original
*/
_getExtension: function(fn) {
// from http://stackoverflow.com/a/680982/292947
var re = /(?:\.([^.]+))?$/;
var tmpext = re.exec(fn)[1];
return (tmpext) ? tmpext : '';
},
@juliobetta
juliobetta / README.markdown
Created October 17, 2012 23:42 — forked from Yavari/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
@juliobetta
juliobetta / chosen.rb
Created August 7, 2012 15:08 — forked from jaryl/chosen.rb
Select item from chosen js select with Capybara-Webkit
def select_from_chosen(item_text, options)
field_id = find_field(options[:from])[:id]
within "##{field_id}_chzn" do
find('a.chzn-single').click
input = find("div.chzn-search input")
# in some cases, chosen may not has a search field
# so, find li that contains item_text
find("li:contains('#{item_text}')").click
end
end