Skip to content

Instantly share code, notes, and snippets.

View johhansantana's full-sized avatar

Johhan Santana johhansantana

View GitHub Profile
@motorcitymobi
motorcitymobi / Info.txt
Created January 22, 2013 18:35
Smooth Scroll
Anchor:
<a name="programs"></a>
Link:
<a href="#programs" class="smoothScroll">
Add to Footer:
<script src="js/smoothscroll.js"></script>
@roelvan
roelvan / dev-server.js
Created November 26, 2018 11:48
NOW v2 Local DEV env Node.js
require('dotenv').config();
const http = require('http');
const url = require('url');
// import NOW SETTINGS
const now = require('./now.json');
const PORT = process.env.PORT || 3030;
const routes = now.routes.reduce((map, route) => {
@deptno
deptno / fragment.ts
Created June 25, 2018 02:53
graphql-tag fragment example
import gql from 'graphql-tag'
const FRAGMENT_REPOSITORY = gql`
fragment repository on Repository {
name
url
createdAt
description
descriptionHTML
labels {
@leocaseiro
leocaseiro / .htaccess
Last active February 23, 2022 03:59
Angular html5Mode apache working in a subdirectory /app using ngRoute
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*) /app/index.html [NC,L]
</IfModule>
<template name="ForgotPassword">
<form action="/forgot" id="forgotPasswordForm" method="post">
<input id="forgotPasswordEmail" type="text" name="email" placeholder="Email Address">
<input class="btn-submit" type="submit" value="Send">
</form>
<!-- end #forgot-password-form -->
</template>
@mlynch
mlynch / autofocus.js
Last active August 24, 2022 15:03
AngularJS Autofocus directive
/**
* the HTML5 autofocus property can be finicky when it comes to dynamically loaded
* templates and such with AngularJS. Use this simple directive to
* tame this beast once and for all.
*
* Usage:
* <input type="text" autofocus>
*
* License: MIT
*/
@lambdahands
lambdahands / _readme.md
Created September 28, 2015 17:09
FlowType and CSS Modules

Huh?

So basically FlowType doesn't know about CSS Modules, a really handy way of dealing with the plagues of CSS in codebases (global variables and dependency wackiness mainly).

What WebPack allows us to do is "require" CSS files and use their class names:

import styles from "my_styles.css";
import React from "react";
@kevinsalter
kevinsalter / array-spread-reordering.js
Last active June 25, 2023 12:04
reordering array using ES2015 array spread operator
const reorderArray = (event, originalArray) => {
const movedItem = originalArray.find((item, index) => index === event.oldIndex);
const remainingItems = originalArray.filter((item, index) => index !== event.oldIndex);
const reorderedItems = [
...remainingItems.slice(0, event.newIndex),
movedItem,
...remainingItems.slice(event.newIndex)
];
@eSlider
eSlider / mbtiles2pbf.sh
Created September 24, 2019 13:53
Extract PBF tiles from mbtiles (SQLite)
#!/bin/sh
git clone https://github.com/mapbox/mbutil
cd mbutil
./mb-util --image_format=pbf *.mbtiles tiles
gzip -d -r -S .pbf *
find . -type f -exec mv '{}' '{}'.pbf \;
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh