Skip to content

Instantly share code, notes, and snippets.

View GGrassiant's full-sized avatar
:octocat:
Continuously learning

Guillaume Grassiant GGrassiant

:octocat:
Continuously learning
View GitHub Profile
@ssaunier
ssaunier / user_binding.json
Created December 3, 2017 21:10
Sublime Key Bindings for using Emmet inside Babel JavaScript files. Sublime > Preferences > Key Bindings
[
{ "keys": ["tab"], "command": "expand_abbreviation_by_tab", "context":
[
{ "operand": "source.js", "operator": "equal", "match_all": true, "key": "selector" },
{ "match_all": true, "key": "selection_empty" },
{ "operator": "equal", "operand": false, "match_all": true, "key": "has_next_field" },
{ "operand": false, "operator": "equal", "match_all": true, "key": "auto_complete_visible" },
{ "match_all": true, "key": "is_abbreviation" }
]
}
function * fibonacci(seed1, seed2) {
while (true) {
yield (() => {
seed2 = seed2 + seed1;
seed1 = seed2 - seed1;
return seed2;
})();
}
}
@toadkicker
toadkicker / about.html.erb
Last active January 25, 2022 23:56
How to build the simplest static site with Rails (yes I know you can put files in public and call that simpler. This uses the framework)
<p>Hi! I'm an about page. Edit me in views/static_pages/</p>
@stevecondylios
stevecondylios / contact-form.md
Last active December 23, 2022 07:33
Tutorial: Create and Deploy a Contact Form to Production in Ruby on Rails 5

Create a Contact Form in Rails 5



2021 UPDATE: some parts of this tutorial are now out of date, please use Create a Contact Form in Rails 6 instead. The rails 5 / gmail version remains below for posterity.






This is a complete, step-by-step tutorial showing how to create a fully functional contact form in production in rails 5. Rather than reinvent things, the following borrows from the best available documentation and tutorials (most notably, this tutorial on making a contact form in development). The finished contact form can be viewed here.

@CodeDraken
CodeDraken / typeof.c
Created September 25, 2018 00:20
js-typeof-soruce
JS_PUBLIC_API(JSType)
JS_TypeOfValue(JSContext *cx, jsval v)
{
JSType type = JSTYPE_VOID;
JSObject *obj;
JSObjectOps *ops;
JSClass *clasp;
CHECK_REQUEST(cx);
if (JSVAL_IS_VOID(v)) { // (1)
// IntersectionObserver polyfill
import 'intersection-observer'
// *****************************
import React, { Component } from 'react'
export default class ImageLazyLoader extends Component {
state = {
isLoaded: false,
@quisido
quisido / solution.js
Created December 12, 2018 13:30
Variable length currying in JavaScript
// Given an array of numbers, if the index is even, add.
// If the index is odd, subtract.
const addSubtractReducer = (total, current, index) =>
(index % 2) === 0 ?
total + current :
total - current;
const addSubtract = x => {
const nums = [ ];
const SSkeletonPulse = styled.div`
display: inline-block;
height: 100%;
width: 100%;
background: ${props =>
props.translucent
? css`linear-gradient(-90deg, #C1C1C1 0%, #F8F8F8 50%, #C1C1C1 100%)`
: css`linear-gradient(-90deg, #F0F0F0 0%, #F8F8F8 50%, #F0F0F0 100%)`};
background-size: 400% 400%;
animation: pulse 1.2s ease-in-out infinite;
/**
* Creating objects with Classes
* Versus objects with prototypes
* Since JavaScript is not a Class-based language
* what is happening behind the class syntax?
*/
let PersonC = class {
constructor(nm, id) {
this.name = nm;
import React, { FC } from 'react'
import { SWRConfig } from 'swr'
import axios from 'axios'
import { ProfileContainer } from './ProfileContainer'
import './App.css'
const fetcher = (url: string) =>
axios(url).then(
response =>