Skip to content

Instantly share code, notes, and snippets.

@walidvb
walidvb / Gemfile
Created May 20, 2016 16:23
RailsAdmin config for translatable models
#### I18n
gem 'rails-i18n', '~> 4.0.0'
gem 'globalize'
gem 'rails_admin', github: 'sferik/rails_admin'
gem 'rails_admin_globalize_field'
@walidvb
walidvb / Parralax.js
Last active May 18, 2016 11:43
Parralax background image
var $elem = $('.has-background-image');
function parallax() {
var top = $elem.offset().top;
if((pos = (top-window.scrollY))-window.innerHeight <= 0)
{
var yPos = pos * 0.15;
var coords = "50% "+yPos+"px";
$elem.css("backgroundPosition", coords);
}
};
Job failed to load: allocator undefined for Proc. Handler: "--- !ruby/object:Delayed::PerformableMethod\nobject: !ruby/object:CommentsMailer\n _routes: \n _action_has_layout: true\n _mail_was_called: false\n _message: !ruby/object:Mail::Message\n body: !ruby/object:Mail::Body\n boundary: \n preamble: \n epilogue: \n charset: US-ASCII\n part_sort_order:\n - text/plain\n - text/enriched\n - text/html\n parts: !ruby/array:Mail::PartsList []\n raw_source: ''\n encoding: 7bit\n body_raw: \n separate_parts: false\n text_part: \n html_part: \n errors: \n header: !ruby/object:Mail::Header\n errors: []\n charset: UTF-8\n raw_source: ''\n fields: !ruby/array:Mail::FieldList []\n charset: UTF-8\n defaulted_charset: true\n smtp_envelope_from: \n smtp_envelope_to: \n perform_deliveries: true\n raise_delivery_errors: true\n delivery_handler: \n delivery_method: !ruby/object:Mail::SMTP\n settings:
@walidvb
walidvb / hell.jsx
Created June 25, 2015 23:33
Knowing which Select was triggered
var App = React.createClass({
userTr: function(user){
var success = function(res){this.setState(res)};
var updateUserWith() = function(){
return function(value){
$.ajax('/users/'+user.id, {property: value}, sucess);
};
}
return (
<Reactable.Tr>
@walidvb
walidvb / button.js
Created April 29, 2015 10:00
button.js script of infomaniak
if (typeof jQuery === "undefined" || jQuery.fn.jquery !== '1.7.1') {
var script_tag = document.createElement('script');
script_tag.setAttribute("type","text/javascript");
script_tag.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js");
script_tag.onload = ml_load_libs;
script_tag.onreadystatechange = function () {
if (this.readyState == 'complete' || this.readyState == 'loaded') ml_load_libs();
}
document.getElementsByTagName("head")[0].appendChild(script_tag);
} else {
import fontastic.*;
import krister.Ess.*;
int bufferSize;
int steps;
float limitDiff;
int numAverages=32;
float myDamp=.1f;
@walidvb
walidvb / custom_devise_mailer.rb
Last active August 29, 2015 14:12
Allow admin to edit emails sent by Devise
class CustomDeviseMailer < Devise::Mailer
def self.deliver_welcome_email(user)
self.welcome_email(user)
end
def welcome_email(user)
@user = user
# if the email's ID is 1
@welcome_email = Email.find_by_id(1)
mail(to: @user.email, subject: "Welcome to The Pigeonhole!")
on gaston-13-13 > ~/dev/pigeonhole/pigeonhole-ios (master)*$ rake frank
`sugarcube-uikit' has been renamed to (platform agnostic) `sugarcube-ui'
WARNING! BubbleWrap::HTTP is deprecated and will be removed, see https://github.com/rubymotion/BubbleWrap/issues/308
WARNING! Switch to a different networking library soon - consider AFNetworking: http://afnetworking.com/
WARNING! You can use the 'bubble-wrap-http' gem if you need compatibility: https://github.com/rubymotion/BubbleWrap-HTTP
Build ./build/iPhoneSimulator-7.0-Development
Build /Users/gaston/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/frank-cucumber-1.2.2/frank-skeleton
Build ./Pods.xcodeproj [AFNetworking - Release]
Build ./Pods.xcodeproj [Bolts - Release]
Build ./Pods.xcodeproj [SDK - Release]
@walidvb
walidvb / pattern.
Created November 25, 2014 08:15
font pattern
//////////////////////////// Creating the Font //////////////////////////////////
// import the library
import fontastic.*;
// create a new Fontastic font called "10PRINT"
Fontastic f = new Fontastic(this, "10PRINT");
// we can set a version
f.setVersion("1.0");
config.paperclip_defaults = {
:storage => :fog,
:fog_credentials => {:provider => "Local", :local_root => "#{Rails.root}/public"},
:fog_directory => "/public",
:fog_host => 'localhost:3000'
}