Skip to content

Instantly share code, notes, and snippets.

View jamesholcomb's full-sized avatar

James Holcomb jamesholcomb

View GitHub Profile
@namelos
namelos / react-native-redux.js
Created April 11, 2016 16:02
react native with redux and redux form
import React, {
AppRegistry, Component, StyleSheet,
Text, View, TouchableOpacity, TextInput
} from 'react-native'
import { createStore, combineReducers, bindActionCreators } from 'redux'
import { connect, Provider } from 'react-redux'
import { reducer as form, reduxForm } from 'redux-form'
const Button = ({ children, onPress }) => <TouchableOpacity onPress={onPress}>
<Text>{children}</Text>
@zburgermeiszter
zburgermeiszter / import.sh
Created April 7, 2016 12:55
Import sql file to MariaDB in Docker
docker exec -i CONTAINER_ID /bin/bash -c "export TERM=xterm && mysql -proot -uroot database" < import.sql
@lopspower
lopspower / README.md
Last active May 5, 2025 05:07
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@brennanMKE
brennanMKE / hero.ts
Last active April 6, 2025 07:33
Example of Mongoose with TypeScript and MongoDb
import * as mongoose from 'mongoose';
export let Schema = mongoose.Schema;
export let ObjectId = mongoose.Schema.Types.ObjectId;
export let Mixed = mongoose.Schema.Types.Mixed;
export interface IHeroModel extends mongoose.Document {
name: string;
power: string;
@cgmartin
cgmartin / check-certs.sh
Created January 17, 2016 18:00
Bash SSL Certificate Expiration Check
#!/bin/bash
TARGET="mysite.example.net";
RECIPIENT="[email protected]";
DAYS=7;
echo "checking if $TARGET expires in less than $DAYS days";
expirationdate=$(date -d "$(: | openssl s_client -connect $TARGET:443 -servername $TARGET 2>/dev/null \
| openssl x509 -text \
| grep 'Not After' \
|awk '{print $4,$5,$7}')" '+%s');
in7days=$(($(date +%s) + (86400*$DAYS)));
@mnylen
mnylen / _.md
Last active April 23, 2021 21:17
Debounced fetching to reduce number of requests when doing API proxying through GraphQL

Simple implementation of debounced fetching in GraphQL to allow merging of multiple rest / database requests into one. Although this example uses GraphQL, the debouncedFetch / fetchProgramPlaycount implementations could probably be used in any context to achieve the same result.

This approach was first described by @leebyron at graphql/graphql-js#19 (comment)

For example this allows turning ten requests for playcounts from this GraphQL query into just one:

{
  latestPrograms(first: 10) {
    name,

playcount

@Miserlou
Miserlou / cities.json
Created April 30, 2015 06:58
1000 Largest US Cities By Population With Geographic Coordinates, in JSON
[
{
"city": "New York",
"growth_from_2000_to_2013": "4.8%",
"latitude": 40.7127837,
"longitude": -74.0059413,
"population": "8405837",
"rank": "1",
"state": "New York"
},
@tbranyen
tbranyen / _usage.md
Last active August 15, 2024 21:13
OpenWeatherMap / Weather Icons integration
  1. Include Weather Icons in your app: https://github.com/erikflowers/weather-icons

  2. Include the below JSON in your application, for example purposes, lets assume it's a global named weatherIcons.

  3. Make a request to OpenWeatherMap:

req = $.getJSON('http://api.openweathermap.org/data/2.5/weather?q=London,uk&callback=?');
@hmartiro
hmartiro / zeromq-vs-redis.md
Last active December 16, 2024 04:02
Comparison of ZeroMQ and Redis for a robot control platform

ZeroMQ vs Redis

This document is research for the selection of a communication platform for robot-net.

Goal

The purpose of this component is to enable rapid, reliable, and elegant communication between the various nodes of the network, including controllers, sensors, and actuators (robot drivers). It will act as the core of robot-net to create a standardized infrastructure for robot control.

Requirements:

@jakerella
jakerella / semver-compare.js
Created September 30, 2014 19:50
Semver Comparison
function test() {
var results = [];
results.push(compareSemver("1.8.3", "1.8.3", "=="));
results.push(compareSemver("1.9.1", "1.11.1", "<"));
results.push(compareSemver("1.5.3", "1.9", "<"));
results.push(compareSemver("1.3.2", "1.10.2", "<="));
results.push(compareSemver("1.3.2", "1.3.2", "<="));
results.push(compareSemver("1.11.1", "1.9.1", ">"));
results.push(compareSemver("1.11.1", "1.11.0", ">"));
results.push(compareSemver("1.10.2", "1.5.2", ">="));