Skip to content

Instantly share code, notes, and snippets.

View gausam's full-sized avatar

Sam gausam

View GitHub Profile
@kevinkub
kevinkub / scriptable-line-chart.js
Last active February 1, 2024 15:18
Simple line chart class for https://scriptable.app 📈
class LineChart {
// LineChart by https://kevinkub.de/
constructor(width, height, values) {
this.ctx = new DrawContext();
this.ctx.size = new Size(width, height);
this.values = values;
}
_calculatePath() {
import React, { useState } from "react"
import PropTypes from 'prop-types'
import "./input.css"
import TypingIndicator from "./TypingIndicator"
const input = (props) => {
const styles = ["plank", "staggered", "split"]
const [stateIsFocused, setStateIsFocused] = useState(false)
@dominictarr
dominictarr / readme.md
Created November 26, 2018 22:39
statement on event-stream compromise

Hey everyone - this is not just a one off thing, there are likely to be many other modules in your dependency trees that are now a burden to their authors. I didn't create this code for altruistic motivations, I created it for fun. I was learning, and learning is fun. I gave it away because it was easy to do so, and because sharing helps learning too. I think most of the small modules on npm were created for reasons like this. However, that was a long time ago. I've since moved on from this module and moved on from that thing too and in the process of moving on from that as well. I've written way better modules than this, the internet just hasn't fully caught up.

@broros

otherwise why would he hand over a popular package to a stranger?

If it's not fun anymore, you get literally nothing from maintaining a popular package.

One time, I was working as a dishwasher in a restu

@mauricedb
mauricedb / Subject under test
Last active December 7, 2023 14:46
Testing stateful React hooks
import { useState } from 'react';
export function useCounter(initial = 0) {
const [count, setCount] = useState(initial);
return [count, () => setCount(count + 1)];
}
@woganmay
woganmay / auto-project-manager.gs
Created September 7, 2018 09:40
Pull Toggl entries through the Reports API, into an incremental Sheet tab.
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('My Business')
.addItem('Refresh Timesheets', 'getTimesheets')
.addToUi();
}
function getTimesheets() {
// Read API token and Workspace ID from Configuration tab
@wcandillon
wcandillon / wallet-animation.js
Created September 3, 2018 09:28
React Native Apple Wallet Animation
import React from "react";
import {
StyleSheet,
Text,
View,
ScrollView,
Animated,
SafeAreaView,
Dimensions
} from "react-native";
@aprilmintacpineda
aprilmintacpineda / Using Multiple SSH keys - Beginner Friendly.md
Last active June 19, 2024 17:12
Beginner Friendly: Using Multiple SSH keys

How to follow this guide

The problem

I have one computer and two different github accounts. One is for work, the other is for my personal stuff. I can't use the same ssh key twice, so I have to use different ssh key for each of my accounts. How do I do that? How do I switch between these ssh keys?

@joseprl89
joseprl89 / SupportActivityLifecycleOwner.java
Last active June 6, 2021 06:14
How SupportActicity implements LifecycleOwner for Internals of Android Architecture Components Part II- LiveData
public class SupportActivity extends Activity implements LifecycleOwner {
...
private LifecycleRegistry mLifecycleRegistry = new LifecycleRegistry(this);
...
@Override
protected void onSaveInstanceState(Bundle outState) {
@mreichelt
mreichelt / build.gradle
Last active January 22, 2019 12:47
Example of build.gradle where the signing config comes from system environment variables
android {
signingConfigs {
release {
// export these as environment variables like ORG_GRADLE_PROJECT_MYAPP_RELEASE_STORE_FILE
// (prefix 'ORG_GRADLE_PROJECT_' is needed for Gradle project properties)
storeFile rootProject.file('app/' + project.findProperty('MYAPP_RELEASE_STORE_FILE'))
storePassword project.findProperty('MYAPP_RELEASE_STORE_PASSWORD')
keyAlias project.findProperty('MYAPP_RELEASE_KEY_ALIAS')
keyPassword project.findProperty('MYAPP_RELEASE_KEY_PASSWORD')
}
@gaearon
gaearon / prepack-gentle-intro-1.md
Last active May 3, 2024 12:56
A Gentle Introduction to Prepack, Part 1

Note:

When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.