Skip to content

Instantly share code, notes, and snippets.

View CharlyMartin's full-sized avatar
👨‍💻
Working remotely

Charly MARTIN CharlyMartin

👨‍💻
Working remotely
View GitHub Profile
@YagoLopez
YagoLopez / deep-search-javascript-object.js
Last active January 8, 2023 10:02
Deep search javascript object
/* Attribution: http://techslides.com/how-to-parse-and-search-json-in-javascript */
//return an array of objects according to key, value, or key and value matching
function getObjects(obj, key, val) {
var objects = [];
for (var i in obj) {
if (!obj.hasOwnProperty(i)) continue;
if (typeof obj[i] == 'object') {
objects = objects.concat(getObjects(obj[i], key, val));
} else

Plugging a Datepicker

Let's put an end to datepicker suffering! Follow this steps to have your shiny new datepicker working in no time! (and remind yourselves of JS plugins in Rails)

Note: We recommend using Bootstrap Datepicker (try your own luck with anything different and remember, jQuery-UI's datepicker sucks, don't use it). These are the only three links you need:

  1. Docs
  2. Demo. Where you can play with different settings.
@pel-daniel
pel-daniel / cheatsheet.md
Last active September 11, 2017 20:37
Rails conventions

Rails conventions

General

All filenames are in snake_case following the same conventions

  • Model: singular (e.g. Restaurant)
  • Controller: plural (e.g. RestaurantsController)
  • Table in DB: plural (e.g. restaurants)
  • URL's: all in plural (e.g. /restaurants, /restaurants/:id, /restaurants/new)
anonymous
anonymous / application.js
Created February 10, 2017 09:45
$(document).ready(function() {
// create your api key in your dashboard at https://dashboard.clearbit.com/keys
var apiKey = "[REPLACE WITH YOUR API KEY]";
$("#signup").submit(function(event) {
var email = $("#email").val();
event.preventDefault();
$.ajax({
type: "GET",
url: "https://person.clearbit.com/v2/combined/find?email=" + email,
@cabans
cabans / consolelog-snippet.xml
Last active February 12, 2021 14:02
Add console log autocompletion snippet to Sublime Text
<snippet>
<!-- put this file in /packages/User/<Folder Name>/console_log.sublime-snippet then restart your Sublime Text -->
<content><![CDATA[console.log($1);$0]]></content>
<tabTrigger>log</tabTrigger>
<scope>text.html,source.js</scope>
<description>console.log()</description>
</snippet>
@brianpetro
brianpetro / rails-4-new-options
Created April 28, 2015 18:11
Command line options for ` rails new --help ` (Rails 4.2). Useful for planning new Ruby on Rails app. 'Where can I find options for “rails new” command?'
Because I couldn't find these with a quick Google search on 28 April 2015:
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /home/brian/.rvm/rubies/ruby-2.2.0/bin/ruby
-m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
[--skip-gemfile], [--no-skip-gemfile] # Don't create a Gemfile
@GRoguelon
GRoguelon / devise.fr.yml
Last active September 30, 2016 09:30
French translation of devise.en.yml (version: 3.2.4).
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
fr:
devise:
confirmations:
confirmed: 'Votre compte a été validé.'
send_instructions: 'Vous allez recevoir les instructions nécessaires à la confirmation de votre compte dans quelques minutes.'
send_paranoid_instructions: 'Si votre e-mail existe dans notre base de données, vous allez bientôt recevoir un e-mail contenant les instructions de confirmation de votre compte.'
failure:
already_authenticated: "Vous êtes déjà connecté"
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active July 13, 2024 21:24
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx