Skip to content

Instantly share code, notes, and snippets.

View syropian's full-sized avatar
🐝
vibing

Collin Henderson syropian

🐝
vibing
View GitHub Profile
@syropian
syropian / withHiddenHomeIndicator.js
Created August 22, 2022 23:13
An Expo config plugin to automatically hide the home indicator on iOS
const { withAppDelegate } = require('@expo/config-plugins')
function withHiddenHomeIndicator(expoConfig) {
return withAppDelegate(expoConfig, (config) => {
const { modResults } = config
const { contents } = modResults
const lines = contents.split('\n')
const importIndex = lines.findIndex((line) => /^#import "AppDelegate.h"/.test(line))
@syropian
syropian / async-task-queue.js
Last active March 4, 2021 17:54
Lets you queue up async tasks and executes them sequentially
const queueTask = (() => {
let pending = () => Promise.resolve();
const run = async (fn) => {
try {
await pending;
} finally {
return fn();
}
};
const groupSiblingsByKeyValue = (arr, k, v) => {
return arr
.map((o, i, a) => {
if (o[k] === v) {
let j = i;
const group = [];
while (a[j][k] === v) {
group.push(a[j]);
a[j] = false;
j++;
2018/07/01 14:15:41 [error] 98678#0: *1 connect() to unix:/Users/user/.valet/valet.sock failed (61: Connection refused) while connecting to upstream, client: 127.0.0.1, server: astral.test, request: "GET /favicon.ico HTTP/2.0", upstream: "fastcgi://unix:/Users/user/.valet/valet.sock:", host: "astral.test", referrer: "https://astral.test/"
$(document.getElementById("preview").contentWindow.document).on("dragover drop", function(e) {
return e.preventDefault();
});
module.exports = function(grunt) {
// 1. All configuration goes here
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
options: {
loadPath: require('node-bourbon').includePaths,
style: 'compressed'
},
{
"name": "Bourbon Test",
"version": "1.0.0",
"repository": "",
"devDependencies": {
"node-bourbon": "~1.0.0",
"grunt": "~0.4.4",
"grunt-contrib-sass": "~0.7.3"
}
}
@syropian
syropian / gitprompt.sh
Created May 4, 2014 12:45
My bash prompt
PS1='\u:\[\033[0;37m\]\W\e[0m$(__git_ps1 :"\[\033[0;35m\][%s]\e[0m")\$ '
@syropian
syropian / gist:9218366
Created February 25, 2014 21:35
John Resig's HTML parser, but with support for data-attributes
/*
* HTML Parser By John Resig (ejohn.org)
* Original code by Erik Arvidsson, Mozilla Public License
* http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
*
* // Use like so:
* HTMLParser(htmlString, {
* start: function(tag, attrs, unary) {},
* end: function(tag) {},
* chars: function(text) {},
@syropian
syropian / js_obj_helpers.js
Created August 29, 2013 19:53
A few handy JS helper methods for getting the count of a JS object, as well as getting the index of an object by key.
//Helper Methods
function getObjectCount(obj) {
var count = 0;
var key;
for(key in obj) {
if(obj.hasOwnProperty(key)) count++;
}
return count;
}