Skip to content

Instantly share code, notes, and snippets.

View tawanorg's full-sized avatar
🎯
Focusing

Tew Tawan tawanorg

🎯
Focusing
View GitHub Profile
@tawanorg
tawanorg / app.js
Created February 1, 2016 17:34 — forked from sogko/app.js
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
@tawanorg
tawanorg / Debug-Knockout-JS.html
Created October 26, 2016 01:24 — forked from maxcnunes/Debug-Knockout-JS.html
Simple way to debug viewmodel data bind with knockout
<pre data-bind="text: ko.toJSON($data, null, 2)"></pre>
@tawanorg
tawanorg / geolocation.js
Created June 14, 2017 12:01 — forked from allpwrfulroot/geolocation.js
Funky error, async issue or geolocation bug? watchPositionAsync callback EXPLODES (counter goes to hundreds) if getCurrentPosition called?
import React, { Component } from 'react'
import {
ActivityIndicator,
View,
Text,
Alert
} from 'react-native'
import { Permissions, Location, Notifications, Constants } from 'expo'
import { graphql, gql, compose } from 'react-apollo'
import update from 'immutability-helper'
// Alerts
@include alert-variant($background, $border, $text-color);
// Background Variant
@include bg-variant($parent, $color);
// Border Radius
@include border-top-radius($radius);
@include border-right-radius($radius);
@include border-bottom-radius($radius);
@tawanorg
tawanorg / __responsive styled components
Created July 23, 2018 11:09 — forked from granmoe/__responsive styled components
Programmatically create responsive styled components with react and styled-components
// this file is just here to change the name of the gist
import React from 'react'
import styled from 'styled-components'
const makeResponsiveComponent = (rulesets, tagName = 'div') =>
styled(tagName)`${buildStyles(rulesets)}`
const buildStyles = rulesets =>
rulesets.reduce(
(cssString, { constraint, width, rules }) =>
@tawanorg
tawanorg / bootstrap-mq.scss
Created April 4, 2019 13:18 — forked from olegpolyakov/bootstrap-mq.scss
Bootstrap Sass Media Query Variables
//== Media queries breakpoints
// Extra small screen / phone
$screen-xs: 480px;
$screen-xs-min: $screen-xs;
// Small screen / tablet
$screen-sm: 768px;
$screen-sm-min: $screen-sm;
@tawanorg
tawanorg / AppDelegate.m
Created April 1, 2020 01:05 — forked from Jpoliachik/AppDelegate.m
ReactNative iOS Launch Screen No Flash
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// 1. init window
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
// 2. backgroundView using LaunchScreen.xib
UIView *backgroundView = [[[NSBundle mainBundle] loadNibNamed:@"LaunchScreen" owner:self options:nil] firstObject];
backgroundView.frame = self.window.bounds;
@tawanorg
tawanorg / ProgressiveImgLoader.js
Created July 3, 2020 04:26 — forked from knee-cola/ProgressiveImgLoader.js
simple progressive texture image loader for Three.js
/**
* @author knee-cola / https://github.com/knee-cola
* Original file URL: https://gist.github.com/knee-cola/37875bc4359609b96c9f329cd2a68fa1
*/
// This is a simple progressive image loader for Three.js
// It enables the smaller image files to be loaded first,
// before the big texture image is fully loaded.
//
// The images are loaded in the order they are passed
@tawanorg
tawanorg / top-brew-packages.txt
Created November 23, 2020 11:21 — forked from pmkay/top-brew-packages.txt
Top homebrew packages
node: Platform built on V8 to build network applications
git: Distributed revision control system
wget: Internet file retriever
yarn: JavaScript package manager
python3: Interpreted, interactive, object-oriented programming language
python: Interpreted, interactive, object-oriented programming language
mysql: Open source relational database management system
coreutils: GNU File, Shell, and Text utilities
openssl: SSL/TLS cryptography library
postgresql: Object-relational database system
@tawanorg
tawanorg / clean_node_modules.sh
Created July 31, 2021 17:52 — forked from zephraph/clean_node_modules.sh
A shell script to clean up all node_modules in projects that haven't been touched in a couple weeks.
#!/bin/bash
DAYS_SINCE_LAST_CHANGE=14 # If a project hasn't been touched in this long its node_modules will be deleted
SEARCH_PATH="./Git" # Update this to the path where your code is stored
TOTAL_BYTES_REMOVED=0
Mb=1000000
Kb=1000
node_modules=$(find $SEARCH_PATH -name "node_modules" -type d -prune)