Skip to content

Instantly share code, notes, and snippets.

View alextoul's full-sized avatar

Alex Toulemonde alextoul

View GitHub Profile
@alextoul
alextoul / gist:1357745
Created November 11, 2011 11:01
jQuery JSON call best practice
$("#show_teams").live("pagebeforeshow",
function(event,ui)
{
$.ajax({"url":'http://hockey-community.com/api/users/<%= @current_user.username %>/teams',"dataType":"json","async": false,"context":this,
"error":onError(), "success": function(teams)
{
console.log("calling API for teams");
if (teams.length > 0){
$.each(teams, function() {
console.log('loading team'+this.team.name);
@alextoul
alextoul / playonnewsletter
Created April 18, 2012 22:05
HTML TO CODE AND PASTE
<center><span style="color:red;">*** IMPORTANT - Action Required ***</span></center><br><br>
Hi all,<br><br>
A big part of our role is to make sure your team gets the tournament schedules on time. We are excited to announce our partnership with Hockey Community that will bring your schedules straight to your mobile.<br><br>
<b>Before, it is important that you register your team on <a href="http://hockey-community.com/playon?utm_source=playon" style="text-decoration:none" target="_blank">http://hockey-community.com</a>.</b><br><br>
<b>Step 1:</b> Sign up on <a href="http://hockey-community.com/playon?utm_source=playon" style="text-decoration:none" target="_blank">http://hockey-community.com</a> or download the iphone app here <a href="http://bit.ly/hcapp" style="text-decoration:none" target="_blank">http://bit.ly/hcapp</a>.<br><br>
alexs-mbp:~ alextoul$ pkgutil --pkg-info com.apple.pkg.DeveloperToolsCLI
No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
alexs-mbp:~ alextoul$ rvmsudo rvm fix-permissions user
Warning: can not check `/etc/sudoers` for `secure_path`, falling back to call via `/usr/bin/env`, this breaks rules from `/etc/sudoers`. export rvmsudo_secure_path=1 to avoid the warning.
alexs-mbp:~ alextoul$ rvm install 1.8.7 --debug
1.8.7 - install
Searching for binary rubies, this might take some time.
Remote file does not exist https://rvm.io/binaries/osx/10/x86_64/ruby-1.8.7-p371.tar.bz2
Remote file does not exist http://jruby.org.s3.amazonaws.com/downloads/ruby-1.8.7-p371.tar.bz2
Remote file does not exist http://binaries.rubini.us/osx/10/x86_64/ruby-1.8.7-p371.tar.bz2
sudo rvm install 1.8.7 --debug
1.8.7 - install
Searching for binary rubies, this might take some time.
Remote file does not exist https://rvm.io/binaries/osx/10.9/x86_64/ruby-1.8.7-p371.tar.bz2
Remote file does not exist http://jruby.org.s3.amazonaws.com/downloads/ruby-1.8.7-p371.tar.bz2
Remote file does not exist http://binaries.rubini.us/osx/10.9/x86_64/ruby-1.8.7-p371.tar.bz2
rvm_remote_server_url3 not found
No remote file name found
No binary rubies available for: osx/10.9/x86_64/ruby-1.8.7-p371.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
[2013-06-18 15:28:27] ./configure
current path: /Users/alextoul/.rvm/src/ruby-1.8.7-p371
command(9): env CFLAGS=-O3 -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libxml2/include -I/usr/local/opt/libxslt/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl098/include LDFLAGS=-L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libxml2/lib -L/usr/local/opt/libxslt/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl098/lib ./configure --prefix=/Users/alextoul/.rvm/rubies/ruby-1.8.7-p371 --disable-install-doc --without-tcl --without-tk --enable-shared
configure: WARNING: unrecognized options: --without-tcl, --without-tk
checking build system type... i686-apple-darwin13.0.0
checking host system type... i686-apple-darwin13.0.0
checking target system type... i686-apple-darwin13.0.0
checking whether the C compiler works... no
configure: error: in `/Users/alextoul/.rvm/src/ruby-1.8.7-p371':
configure: error: C compiler cannot create execut
1.8.7 - install
Searching for binary rubies, this might take some time.
Remote file does not exist https://rvm.io/binaries/osx/10.9/x86_64/ruby-1.8.7-p371.tar.bz2
Remote file does not exist http://jruby.org.s3.amazonaws.com/downloads/ruby-1.8.7-p371.tar.bz2
Remote file does not exist http://binaries.rubini.us/osx/10.9/x86_64/ruby-1.8.7-p371.tar.bz2
rvm_remote_server_url3 not found
No remote file name found
No binary rubies available for: osx/10.9/x86_64/ruby-1.8.7-p371.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
__rvm_setup_compile_environment_setup ruby-1.8.7-p371
import { Component } from '@angular/core';
import {
GOOGLE_MAPS_DIRECTIVES,
GOOGLE_MAPS_PROVIDERS
} from 'angular2-google-maps/core';
import {AngularFire} from 'angularfire2';
import { Http, Response, URLSearchParams } from '@angular/http';
import {Observable} from 'rxjs/Rx';
import {lessThan} from './less-than.pipe'
@alextoul
alextoul / user.rb
Created November 13, 2018 14:21
user.rb
has_one :profile_pictures_album, ->{ where "media_albums.permalink = 'profile_pictures'" }, class_name: 'Media::Album', as: :owner
has_one :cover_photos_album, ->{ where "media_albums.permalink = 'cover_photos'" }, class_name: 'Media::Album', as: :owner
has_one :uploads_photos_album, ->{ where "media_albums.permalink = 'uploads'" }, class_name: 'Media::Album', as: :owner
has_one :location, ->{ where '`social_locations`.`default` = true' }, class_name: 'Social::Location'
has_one :email_address, ->{ where default: true }, class_name: 'Auth::EmailAddress'
has_many :email_addresses, class_name: 'Auth::EmailAddress', dependent: :destroy
has_many :verified_email_addresses, ->{ where.not(verified_at: nil) }, class_name: 'Auth::EmailAddress', dependent: :destroy
has_many :devices, class_name: 'Auth::Device', dependent: :destroy
@alextoul
alextoul / Decathlon-Sports-RubyGem-HelloWorld-attempt.rb
Created January 3, 2019 17:21
Decathlon-Sports-RubyGem-HelloWorld-attempt.rb
#!/usr/bin/ruby
#
# Hello Word script to execute the 'decathlon-sports' Ruby Gem
#
#
# GOAL: Suggest the user a sport to practice knowing he loves snowboarding
#
<?php
// Get the search query
$search_query = sanitize_text_field($_GET['s']);
// Create a new WP_Query object with the search parameters
$args = array(
'post_type' => 'post',
'posts_per_page' => 12,
'orderby' => 'date',
's' => $search_query,