This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CGContextRef ctx = UIGraphicsGetCurrentContext(); // your drawing context | |
CGRect colorRect = CGRectMake(0, 0, 100, 100); // the rect to draw the color overlay into | |
// Set the blend mode to "Normal" | |
// This is the default blend mode setting so this line is not required, shown here for demonstration | |
CGContextSetBlendMode(ctx, kCGBlendModeNormal); | |
// Set the opacity of the drawing context (once again, not required) | |
CGContextSetAlpha(ctx, 1.0); | |
// Create the red color | |
CGColorRef redColor = CGColorCreateGenericRGB(0.908, 0.149, 0.145, 1.000); | |
// Set the fill color of the context and fill the rect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// a bit hackish way of merging two wav files, assumes raw samples. | |
#import <Foundation/Foundation.h> | |
#define RIFF_ID 0x52494646 // "RIFF" | |
#define RIFF_FMT_ID 0x666d7420 // "fmt " | |
#define RIFF_DATA_ID 0x64617461 // "data" | |
typedef struct riffChunkHeader { | |
UInt32 rsc_id; // big endian |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Country | Alpha-2 code | Alpha-3 code | Numeric code | Latitude (average) | Longitude (average) | |
---|---|---|---|---|---|---|
Afghanistan | AF | AFG | 4 | 33 | 65 | |
Åland Islands | AX | ALA | 248 | 60.116667 | 19.9 | |
Albania | AL | ALB | 8 | 41 | 20 | |
Algeria | DZ | DZA | 12 | 28 | 3 | |
American Samoa | AS | ASM | 16 | -14.3333 | -170 | |
Andorra | AD | AND | 20 | 42.5 | 1.6 | |
Angola | AO | AGO | 24 | -12.5 | 18.5 | |
Anguilla | AI | AIA | 660 | 18.25 | -63.1667 | |
Antarctica | AQ | ATA | 10 | -90 | 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSString *)tableView:(UITableView *)tableView titleForSwipeAccessoryButtonForRowAtIndexPath:(NSIndexPath *)indexPath { | |
return @"More"; | |
} | |
- (void)tableView:(UITableView *)tableView swipeAccessoryButtonPushedForRowAtIndexPath:(NSIndexPath *)indexPath { | |
NSLog(@"I wanted to be a pretty public API, but then time ran out and they forgot me..."); | |
// Hide the More/Delete menu. | |
[self setEditing:NO animated:YES]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fish shell | |
egrep "^export " ~/.bash_profile | while read e | |
set var (echo $e | sed -E "s/^export ([A-Z_]+)=(.*)\$/\1/") | |
set value (echo $e | sed -E "s/^export ([A-Z_]+)=(.*)\$/\2/") | |
# remove surrounding quotes if existing | |
set value (echo $value | sed -E "s/^\"(.*)\"\$/\1/") | |
if test $var = "PATH" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type FilterOperator = 'AND' | 'OR'; | |
type FiltersBy<T> = { | |
[K in keyof T]?: (value: T[K]) => boolean; | |
}; | |
/** | |
* Factory function that creates a specialized function to filter | |
* arrays, by validating all filters (AND operator), | |
* or validating just one of the filters (OR operator). | |
* @param operator Method to validate all filters: AND, OR |
Note: This post is a summary of information paraphrased from an excellent blog post by Christian Sepulveda.
Create the app and download the necessary dependencies.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from "react"; | |
import {Animated, Dimensions, Platform, Text, TouchableOpacity, View} from "react-native"; | |
import {Body, Header, List, ListItem as Item, ScrollableTab, Tab, TabHeading, Tabs, Title} from "native-base"; | |
import LinearGradient from "react-native-linear-gradient"; | |
const {width: SCREEN_WIDTH} = Dimensions.get("window"); | |
const IMAGE_HEIGHT = 250; | |
const HEADER_HEIGHT = Platform.OS === "ios" ? 64 : 50; | |
const SCROLL_HEIGHT = IMAGE_HEIGHT - HEADER_HEIGHT; | |
const THEME_COLOR = "rgba(85,186,255, 1)"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useRef, useState } from 'react' | |
import { View, Text, StyleSheet } from 'react-native' | |
import BottomSheet from 'reanimated-bottom-sheet' | |
import { FlatList } from 'react-native-gesture-handler' | |
import { Fragment } from 'react' | |
const data = Array(50) | |
.fill(0) | |
.map((item, index) => ({ | |
id: `item-${index}`, |
OlderNewer