Skip to content

Instantly share code, notes, and snippets.

View kitihounel's full-sized avatar
🎯
Focusing

kitihounel

🎯
Focusing
View GitHub Profile
@thomaslombart
thomaslombart / Switch.vue
Created August 24, 2020 16:03
An example of a toggle switch with Vue 3
<template>
<label class="container">
<input
v-bind="$attrs"
class="input"
type="checkbox"
:checked="checked"
@change="$emit('update:checked', $event.target.checked)"
/>
<span class="switch"></span>
@ryanorsinger
ryanorsinger / list_comprehension_practice.py
Last active July 16, 2024 23:03
17 List Comprehension Exercises
# 17 list comprehension problems in python
fruits = ['mango', 'kiwi', 'strawberry', 'guava', 'pineapple', 'mandarin orange']
numbers = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 17, 19, 23, 256, -8, -4, -2, 5, -9]
# Example for loop solution to add 1 to each number in the list
numbers_plus_one = []
for number in numbers:
numbers_plus_one.append(number + 1)
@evolkmann
evolkmann / importing.module.ts
Created January 4, 2019 15:34
Create Nest.js modules with custom config
import { Module } from '@nestjs/common';
import { MyLibModule } from './my-lib.module';
@Module({
imports: [
MyLibModule.register({ name: 'Enzo' }),
]
})
export class ImportingModule {}
@volf52
volf52 / matrix_ops.py
Created September 5, 2017 12:50
Matrix Minor, Determinant, Transpose, Multiplication and Inverse -Python
def transpose(matrix):
return [[row[i] for row in matrix] for i in range(len(matrix[0]))]
def multip(X, Y):
return [[sum(a*b for a,b in zip(X_row,Y_col)) for Y_col in zip(*Y)] for X_row in X]
def getMatrixMinor(m,i,j):
return [row[:j] + row[j+1:] for row in (m[:i]+m[i+1:])]
@KinoAR
KinoAR / json_minify.py
Last active March 23, 2023 18:49
A JSON minify script written in Python.
#!/usr/bin/env python3
"""JSON minify program. """
import json # import json library
import sys # import sys library
def minify(file_name):
"Minify JSON"
file_data = open(file_name, "r", 1).read() # store file info in variable
json_data = json.loads(file_data) # store in json structure
@resmall
resmall / gist:51b328aa303b15979e77
Last active October 15, 2022 22:14
Imports an sql file and execute the script in Laravel Seeder
public function run() {
DB::unprepared(File::get('path/to/SQL/file'));
}
@brandonmwest
brandonmwest / example.cs
Last active June 27, 2024 04:03
Generating base64-encoded Authorization headers in a variety of languages
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue(
"Basic",
Convert.ToBase64String(
System.Text.ASCIIEncoding.ASCII.GetBytes(
string.Format("{0}:{1}", username, password))));