Skip to content

Instantly share code, notes, and snippets.

Julian Acosta IAmJulianAcosta

Block or report user

Report or block IAmJulianAcosta

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View adapters.application.js
import DS from 'ember-data';
export default DS.JSONAPIAdapter.extend({
findRecord() {
return {
data: {
id: '1',
type: 'books',
attributes: {
config: {}
View controllers.application.js
import Ember from 'ember';
import { A } from '@ember/array';
import ArrayProxy from '@ember/array/proxy';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
init(...args) {
this._super(...args);
let a = ArrayProxy.create({
content: A(["hello", "world"])
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'get lucky'
});
@IAmJulianAcosta
IAmJulianAcosta / VmConfig.sh
Created Apr 21, 2017
Configure Ubuntu VM to compile Ember.js
View VmConfig.sh
#In some steps you should open a new tab and continue there
# Ubuntu packages
sudo apt-get update
sudo apt-get install -y autoconf automake python-dev make git curl samba-libs
# Node and npm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
nvm install 6.10.2
nvm use 6.10.2
@IAmJulianAcosta
IAmJulianAcosta / ember-object-name.js
Last active May 5, 2016
Get Ember object simple name from complex name
View ember-object-name.js
//Returns a string with full name of component, like: <ProjectName@component:path/to/component-name::ember793>
let componentName = this.toString ();
//This regex will match the component and capture the latest part of component path.
let regex = componentName.match (/<[a-zA-Z]+@[a-zA-Z]+:(?:[a-z]+[\/])*([-a-z]+)::[a-zA-Z]+[0-9]+>/);
//The latest element of array is the component name.
console.log (regex[regex.length-1]); //component-name
//See: https://regex101.com/r/rX9bQ7/3 for explanation
View ascii-art-browser-console.js
/*
* © 2016 - Julián Acosta
* License: CC BY-SA 4.0 (http://creativecommons.org/licenses/by-sa/4.0/)
*
* Print your own logo in developer tools!
*
* Step 1: Convert your logo to ASCII text here: http://picascii.com (I used color output)
* Note: Is possible that you'll have to resize your photo in order to retain aspect ratio
* Step 2: Remove the <pre></pre> tag that is surrounding the generated code, replace with "[" and "]"
* Step 3: Run the following regexes (*DON'T ALTER THE ORDER*) in order to convert to JSON (Works in PHPStorm and Sublime Text 2):
@IAmJulianAcosta
IAmJulianAcosta / charset_change.sql
Created Oct 24, 2015
Changing charset of all database tables
View charset_change.sql
SELECT CONCAT( "ALTER TABLE `", TABLE_NAME, "` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" ) AS ExecuteTheString
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = "name_of_table"
AND TABLE_TYPE = "BASE TABLE"
LIMIT 0 , 30
You can’t perform that action at this time.