Skip to content

Instantly share code, notes, and snippets.

View igeligel's full-sized avatar
🤷‍♀️
Shifting bits around the world

Kevin Peters igeligel

🤷‍♀️
Shifting bits around the world
View GitHub Profile
var originalObject = { a: 1, b: 2 };
var newObject = { c: 3 };
var merged = { ...originalObject, ...newObject };
var userIdObject = { id: 1 };
var tonyObject = { name: "tony" };
var c = { ...userIdObject, ...tonyObject };
var yourName = 'Max';
var a = 'Hello ' + yourName;
const yourName = 'Max';
const a = `Hello ${yourName}`;
{
"type": "File",
"start": 0,
"end": 245,
"loc": {
"start": { "line": 1, "column": 0 },
"end": { "line": 16, "column": 0 }
},
"program": {
"type": "Program",
import gql from 'graphql-tag';
import { Query } from 'react-apollo';
const GET_DOGS = gql`
{
dogs {
id
breed
}
}
app.use('/awdawdwad', (request, response, next) => {
// here is your code
});
// Can also be written as:
const awdawdwadHandler = (request, response, next) => {
// here is your code
}
app.use('/awdawdwad', awdawdwadHandler);
@igeligel
igeligel / get-medium-stats.js
Last active December 1, 2022 13:02
medium-get-totals
const totalTypes = {
VIEWS: 2,
READS: 3,
FANS: 5
};
const getTotal = tableColumn =>
[
...document.querySelectorAll(
`td:nth-child(${tableColumn}) > span.sortableTable-number`
@igeligel
igeligel / autopep8.py
Created June 2, 2018 16:04
long_generator_expression_named_tuples
def generator_expression():
Fruit = collections.namedtuple(
'Fruit', ('name', 'size'
'price super_long_property_in_tuple'))
fruits = [
Fruit(
name='apple',
size=5,
price=10.50,
super_long_property_in_tuple='super long string here also, lorem ipsum, maybe longer than 80 characters to look for pep8 violations here. lorem ipsum.'),
@igeligel
igeligel / autopep8.py
Created June 2, 2018 15:45
function with a lot of parameters
def function_with_really_long_name(
normal_variable,
another_normal_variable,
configuration=None,
test_number=1,
test_text='dwadawa',
test_tuple=(
'LoremIpsum',
21)):
return None
@igeligel
igeligel / autopep8.py
Created June 2, 2018 15:30
Basket indentation
class Basket():
reference = models.CharField(
_('Project reference'), max_length=100, null=True)