Skip to content

Instantly share code, notes, and snippets.

//
// main.cpp
// homography
//
// Created by Gaston on 1/17/13.
//
//
#ifndef HOMO
#define HOMO
@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'
}
def facebook_account
u = self.user
link = "https://facebook.com/#{u.facebook}"
ActionController::Base.helpers.link_to("<i class='fa fa-facebook'></i>".html_safe, link, target: "_blank", class: "social-solo facebook") if (!(u.nil?) && !(u.facebook.nil?) && !(u.facebook.empty?) && u.show_facebook?)
end
form do |f|
f.semantic_errors *f.object.errors.keys
f.inputs "Details", :class => "collapsible" do
f.input :title
f.input :author, :label => "Name"
f.input :is_private
f.input :publish_date, :as => :datepicker
f.input :publish_frequency, :as => :number, :label => "Publish Frequency", :step => 1
#TODO: add slug again. Also, understand why this was removed
f.input :slug, :placeholder => "cannot be changed afterwards" unless !f.object.slug.nil?