Skip to content

Instantly share code, notes, and snippets.

View tulios's full-sized avatar

Túlio Ornelas tulios

View GitHub Profile
.
├─ app
│ ├── components
│ ├── controllers
│ ├── helpers
│ ├── routes
│ ├── services
│ ├── templates
│ ├── router.js
│ └── index.js
// jquery.js
import jQuery from 'jquery/dist/jquery.min'
window.jQuery = jQuery
// ember.js
import './jquery'
import 'components-ember/ember.min'
export default window.Ember
// webpack alias
@tulios
tulios / ember-webpack-loaders_module_config.js
Created January 26, 2016 20:34
ember-webpack-loaders module config
{
module: {
loaders: [
{
test: /\.hbs$/,
include: /app\/templates/, // or whatever directory you have
loader: 'ember-webpack-loaders/htmlbars-loader'
},
{
test: /app\/index\.js/, // the main app file
@tulios
tulios / ember_htmlbars_webpack_loader.js
Last active January 26, 2016 20:31
Ember HTMLbars webpack loader
var HtmlbarsCompiler = require('ember-cli-htmlbars')
var templateTree = new HtmlbarsCompiler('../app/templates', {
isHTMLBars: true,
// provide the templateCompiler that is paired with your Ember version
templateCompiler: require('components-ember/ember-template-compiler.js')
});
templateTree.processString(source, templatePath)
@tulios
tulios / server_side_reactjs_with_state.js
Created February 3, 2015 20:19
Server side ReactJS with state
var Promise = require('promise');
var React = require('react/addons');
var Router = require('react-router');
var App = buildRequire('app-server-bundle');
var parseAssetManifest = appServerRequire('utils/parse-asset-manifest');
var assetManifest = parseAssetManifest(App.Settings.ASSET_HOST);
function fetchData(routes, done) {
@tulios
tulios / embedded_svg_helper.rb
Last active May 16, 2020 08:12
embedded_svg helper for Rails
module ApplicationHelper
# Using raw files
def embedded_svg filename, options = {}
root = options[:root] || Rails.root.join("app", "assets", "svgs")
file = File.read(File.join(root, filename))
doc = Nokogiri::HTML::DocumentFragment.parse file
svg = doc.at_css 'svg'
svg['class'] = options[:class] if options[:class].present?
doc.to_html.html_safe
end
@tulios
tulios / helper.rb
Created April 26, 2014 05:01
asset_pipeline_force_debug_false_only_some_manifest
# Helper that use the same logic as javascript_include_tag ensuring body=0 for the manifests
# Usage: <%= always_no_debug_javascript_include_tag 'manifest' %>
#
def always_no_debug_javascript_include_tag *sources
options = sources.extract_options!.stringify_keys
path_options = options.extract!('protocol').symbolize_keys
sources.uniq.map {|source|
path = path_to_javascript(source, path_options)
path.gsub!(/\?body=1/, "?body=0") if path =~ /\?body=1$/
@tulios
tulios / str.go
Last active December 20, 2015 10:39
Reverse string function in GO (study purpose)
package str
func Reverse(input string) string {
rune_array := []rune(input)
size := len(rune_array) - 1
result := make([]rune, size + 1)
for i := 0; i <= size; i++ {
result[size - i] = rune_array[i]
}
$("#slide-container").destaque({
autoSlideDelay: 10000,
resumeSlideDelay: 10000,
onInit: function(instance) {
instance.pause();
},
onResume: function(instance) {
instance.pause();
}
})
@tulios
tulios / css3_activation_jquery_destaque.css
Created November 1, 2012 16:17
CSS 3 activation for jquery.destaque
.item img, .item .foreground {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}