Skip to content

Instantly share code, notes, and snippets.

@jonatanfroes
jonatanfroes / Form.html
Created September 29, 2012 16:58
Codeigniter + Jquery File Upload
<!-- configure a url que irá receber os dados -->
<input id="fileupload" type="file" name="Filedata" data-url="<?php echo site_url('admin/portfolio/save_photo/' . $gallery->id); ?>" multiple />
<div id="progress" class="progress progress-striped active">
<div class="bar" style="width: 0;"></div>
</div>
<div id="upload_result"></div>
<hr />
<!-- /end multiple upload -->
@danielalvarenga
danielalvarenga / script-install-all-ubuntu14.sh
Last active February 19, 2016 11:02
Script Instalação Ubuntu 14.10 (customizable for vagrant provision)
#!/bin/bash
# Autor: Daniel Alvarenga Lima <danielalvarengalima@gmail.com>
# Versão do Ubuntu suportada: 14.10 64Bit
# Versão deste Script: 2015-05-20
# EXECUTE
# sudo chmod +x script-install-all-ubuntu.sh
# ./script-install-all-ubuntu.sh
@pithyless
pithyless / gist:1547408
Created January 1, 2012 14:02
jQuery set Headers for $.ajax
// jQuery Headers support for $.ajax
$.ajax({
beforeSend: function(xhrObj){
xhrObj.setRequestHeader("Content-Type","application/json");
xhrObj.setRequestHeader("Accept","application/json");
}
type: "POST",
url: "/article",
processData: false,
@joshmosh
joshmosh / 01.md
Last active September 17, 2021 18:32
Using binary UUIDs with Ruby (on Rails) and MySQL

Binary UUIDs are much more efficient in space and lookups compared to VARCHAR or CHAR UUIDs. To better exmplain how they work I have a few examples of raw sql and how that translates in a programming language like Ruby using the UUID tools module. All examples will reference the following database table and schema.

Table name: users

 id          :uuid(16)
 first_name  :string(255)
 last_name :string(255)
@janko
janko / 01-safe-download.rb
Last active January 9, 2023 11:40
A safe way in Ruby to download a file to disk using open-uri (with/without comments)
require "open-uri"
require "net/http"
Error = Class.new(StandardError)
DOWNLOAD_ERRORS = [
SocketError,
OpenURI::HTTPError,
RuntimeError,
URI::InvalidURIError,
@artem-zinnatullin
artem-zinnatullin / MyApp.java
Last active January 15, 2023 13:04
If you need to set one font for all TextViews in android application you can use this solution. It will override ALL TextView's typefaces, includes action bar and other standard components, but EditText's password font won't be overriden.
public class MyApp extends Application {
@Override
public void onCreate() {
TypefaceUtil.overrideFont(getApplicationContext(), "SERIF", "fonts/Roboto-Regular.ttf"); // font from assets: "assets/fonts/Roboto-Regular.ttf
}
}
@ruebenramirez
ruebenramirez / setup-franz-ubuntu.sh
Created September 7, 2016 17:55
setup franz on ubuntu
#!/bin/bash
sudo rm -fr /opt/franz
sudo rm -fr /usr/share/applications/franz.desktop
# create installation dir
sudo mkdir -p /opt/franz
#install franz
@rosswd
rosswd / multi-git-win.md
Last active February 28, 2024 09:46
Setting up a Github and Bitbucket account on the same computer on Mac OS. Now with a guide for Windows 10.

Setting up github and bitbucket on the same computer (Windows)

Guide for Windows

mix3d asked for some help using this guide with windows so here we go. This was tested with Windows 10. Run all commands in Git Bash once it's installed.

Github will be the main account and bitbucket the secondary.

Git for Windows

  • Download and install Git for Windows
    • In the installer, select everything but decide if you want a desktop icon (2nd step)
@JunichiIto
JunichiIto / alias_matchers.md
Last active April 16, 2024 16:18
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value