Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / index.html
Created July 7, 2017 04:27
Measure Me
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Measure Me</title>
<link rel="stylesheet" href="style.css">
</head>
<body class="main">
<div>
@joaorafaelm
joaorafaelm / cracklepop.py
Created April 16, 2016 23:28
Crackle pop in python
"""
A program that prints out the numbers 1 to 100 (inclusive).
If the number is divisible by 3, print Crackle instead of the number.
If it's divisible by 5, print Pop.
If it's divisible by both 3 and 5, print CracklePop.
"""
for number in range(1, 101):
if number % 15 == 0:
print ("CracklePop")
continue
@viveksyngh
viveksyngh / DIAGOANL.py
Created September 19, 2015 10:53
Give a N*N square matrix, return an array of its anti-diagonals. Look at the example for more details.
__author__ = 'Vivek'
#Give a N*N square matrix, return an array of its anti-diagonals. Look at the example for more details.
def diagonal(self, A):
res = []
for i in range(2 * len(A) - 1) :
if i < len(A) :
z = 0
else :
@raghubetina
raghubetina / crud_with_ruby.md
Last active March 4, 2019 14:36
CRUD with Ruby

CRUD with Ruby

Here is a quick reference on how to insert, retrieve, update, and delete rows from your database tables using our ActiveRecord-backed Ruby classes.

Adding Tables to the Database

First, we need a Ruby class to represent the real-world thing we're trying to model, and we need an underlying database table to store information about each individual thing.

Rails includes an easy generator to help us get set up with both of these things quickly. Supposed I wanted to create a table to store instructors, with two string columns first_name and last_name. I could use this shortcut from the Command Line:

@codegeous
codegeous / countries.json
Created March 27, 2018 18:52
Explains how to build a search filters in react JS websites
[
{
"name": "Afghanistan",
"code": "AF"
},
{
"name": "Åland Islands",
"code": "AX"
},
{
@sebkouba
sebkouba / ParentChild.es6
Created February 17, 2016 06:00
Basic example to pass values between parent and child components in React.
/**
* Basic example to pass values between parent and child components in React
* Seems to be in line with this
* http://stackoverflow.com/questions/24147331/react-the-right-way-to-pass-form-element-state-to-sibling-parent-elements
* Now I have the state in parent and child. Is that good or bad? Why would I need it in child?
* Could probably take that out
* */
class Parent extends React.Component {
constructor(props) {
super(props);
@srsudar
srsudar / background.html
Created July 27, 2014 18:00
Pasting from the system clipboard using a Chrome extension.
<!DOCTYPE html>
<html>
<head>
<script src="background.js"></script>
</head>
<body>
<textarea id="sandbox"></textarea>
</body>
@marekdano
marekdano / todolist.jsx
Last active October 18, 2023 03:18
Simple Todo list app using React and ES6 with functions delete a todo and/or mark a todo as done
import React from 'react';
/*
Todo app structure
TodoApp
- TodoHeader
- TodoList
- TodoListItem #1
- TodoListItem #2
@ingdir
ingdir / gist:0b211b9253c376f9cfa5
Last active December 3, 2023 11:47
BEM Cheatsheet

BEM Cheatsheet

BLOCK

Block encapsulates a standalone entity that is meaningful on its own.

While blocks can be nested and interact with each other, semantically they remain equal; there is no precedence or hierarchy.

Holistic entities without DOM representation (such as controllers or models) can be blocks as well.