Skip to content

Instantly share code, notes, and snippets.

View gamanox's full-sized avatar

Will Alvarez gamanox

  • Freelance
  • Saltillo, Coahuila, México
  • 08:34 (UTC -06:00)
View GitHub Profile
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once APPPATH.'models/Entity_model.php';
/**
* Member_model
* Clase miembro
*/
class Member_model extends Entity_model {
/**
Prefix Verb URI Pattern Controller#Action
groups_api_branch POST /api/branches/:id/groups(.:format) api/v1/branches#assign_groups {:format=>:json}
toggle_api_branch POST /api/branches/:id/toggle(.:format) api/v1/branches#toggle_is_active {:format=>:json}
api_branch GET /api/branches/:id(.:format) api/v1/branches#show {:format=>:json}
PATCH /api/branches/:id(.:format) api/v1/branches#update {:format=>:json}
PUT /api/branches/:id(.:format) api/v1/branches#update {:format=>:json}
branches_api_clients POST /api/clients/branches(.:format) api/v1/clients#create_branch {:format=>:json}
GET /api/clients/branches(.:format) api/v1/clients#index_branch {:format=>:json}
limits_api_client POST /api/clients/:id/limits(.:format) api/v1/admins#limit_assets
@gamanox
gamanox / AndroidManifest.xml
Created May 13, 2015 20:53
/app/build/intermediates/manifests/full/release/AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.teamcompass.app"
android:versionCode="3"
android:versionName="1.2" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="20" />
@gamanox
gamanox / keystore
Created May 13, 2015 18:00
keystore
gamanox@gamanox-lt:~/Downloads$ jarsigner -verify -verbose:summary -certs tc-gabriel.apk
sm 396 Wed Mar 25 16:51:26 CST 2015 res/anim/abc_fade_in.xml (and 666 more)
X.509, CN=Rafael Jacobo, OU=Android, O=Axented, L=Monterrey, ST=Nuevo Leon, C=MX
[certificate is valid from 12/18/14 3:02 PM to 12/12/39 3:02 PM]
[CertPath not validated: Path does not chain with any of the trust anchors]
s 70033 Wed Mar 25 16:51:28 CST 2015 META-INF/MANIFEST.MF
@gamanox
gamanox / cheers db config.batch
Last active August 29, 2015 14:16
migration for cheers database
rails g scaffold beer name description:text image:attachment family_id:integer style_id:integer alcohol:integer country_id:integer state brewery_id rating:integer --skip-stylesheets
rails g scaffold brewery name description:text image:attachment --skip-stylesheets
rails g scaffold store name description:text image:attachment phone:integer address:text location_id:integer twitter facebook foursquare instagram --skip-stylesheets
rails g scaffold family name description:text image:attachment --skip-stylesheets
rails g scaffold style name description:text image:attachment --skip-stylesheets
rails g scaffold tag name description:text --skip-stylesheets
rails g scaffold location name code:integer --skip-stylesheets
rails g scaffold storetype name description:text --skip-stylesheets
rails g scaffold price beer_id:integer store_id:integer price:decimal{4,2} --skip-stylesheets
@gamanox
gamanox / countrys-alpha03-seeds.rb
Last active August 29, 2015 14:16
Rails seed countries with regional codes and alpha-3 (you need to have a model named Country with name:string alpha:string and code:integer)
Country.create([{name: "Afghanistan",alpha: "AFG",code: "004"},{name: "Åland Islands",alpha: "ALA",code: "248"},{name: "Albania",alpha: "ALB",code: "008"},{name: "Algeria",alpha: "DZA",code: "012"},{name: "American Samoa",alpha: "ASM",code: "016"},{name: "Andorra",alpha: "AND",code: "020"},{name: "Angola",alpha: "AGO",code: "024"},{name: "Anguilla",alpha: "AIA",code: "660"},{name: "Antarctica",alpha: "ATA",code: "010"},{name: "Antigua and Barbuda",alpha: "ATG",code: "028"},{name: "Argentina",alpha: "ARG",code: "032"},{name: "Armenia",alpha: "ARM",code: "051"},{name: "Aruba",alpha: "ABW",code: "533"},{name: "Australia",alpha: "AUS",code: "036"},{name: "Austria",alpha: "AUT",code: "040"},{name: "Azerbaijan",alpha: "AZE",code: "031"},{name: "Bahamas",alpha: "BHS",code: "044"},{name: "Bahrain",alpha: "BHR",code: "048"},{name: "Bangladesh",alpha: "BGD",code: "050"},{name: "Barbados",alpha: "BRB",code: "052"},{name: "Belarus",alpha: "BLR",code: "112"},{name: "Belgium",alpha: "BEL",code: "056"},{name: "Belize",alpha
def get_collection(model_config, scope, pagination)
associations = model_config.list.fields.select { |f| f.type == :belongs_to_association && !f.polymorphic? }.collect { |f| f.association.name }
options = {}
options = options.merge(page: (params[Kaminari.config.param_name] || 1).to_i, per: (params[:per] || model_config.list.items_per_page)) if pagination
options = options.merge(include: associations) unless associations.blank?
options = options.merge(get_sort_hash(model_config))
options = options.merge(query: params[:query]) if params[:query].present?
options = options.merge(filters: params[:f]) if params[:f].present?
options = options.merge(bulk_ids: params[:bulk_ids]) if params[:bulk_ids]
model_config.abstract_model.all(options, scope)
@gamanox
gamanox / objectsorter.coffee
Created August 20, 2014 18:45
coffeescript sort object properties by value in descending
sortSome = (array)->
#pusharray
pusharray = []
#save the object in an array
for position of array
pusharray.push [
position
array[position]
]
#sort the array by values
<script>
var section_counter=1;
var questions=0;
var can_pass=0;
</script>
@gamanox
gamanox / deleteuser
Created July 15, 2014 03:09
delete user pgql
CREATE FUNCTION deletecompita() RETURNS TRIGGER AS $_$
BEGIN
DELETE FROM events_users WHERE user_id = OLD.id;
RETURN OLD;
END $_$ LANGUAGE 'plpgsql';
CREATE TRIGGER delete_user
AFTER DELETE ON users
FOR EACH ROW
EXECUTE PROCEDURE deletecompita();