Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
Coding

Elon Zito simsketch

💻
Coding
View GitHub Profile
View pokemon.csv
NUMBER CODE SERIAL NAME TYPE1 TYPE2 COLOR ABILITY1 ABILITY2 ABILITY HIDDEN GENERATION LEGENDARY MEGA_EVOLUTION HEIGHT WEIGHT HP ATK DEF SP_ATK SP_DEF SPD TOTAL
1 1 11 Bulbasaur Grass Poison Green Overgrow Chrolophyll 1 0 0 0.7 6.9 45 49 49 65 65 45 318
2 1 21 Ivysaur Grass Poison Green Overgrow Chrolophyll 1 0 0 1 13 60 62 63 80 80 60 405
3 1 31 Venusaur Grass Poison Green Overgrow Chrolophyll 1 0 0 2 100 80 82 83 100 100 80 525
3 2 32 Mega Venusaur Grass Poison Green Thick Fat 1 0 1 2.4 155.5 80 100 123 122 120 80 625
4 1 41 Charmander Fire Red Blaze Solar Power 1 0 0 0.6 8.5 39 52 43 60 50 65 309
5 1 51 Charmeleon Fire Red Blaze Solar Power 1 0 0 1.1 19 58 64 58 80 65 80 405
6 1 61 Charizard Fire Flying Red Blaze Solar Power 1 0 0 1.7 90.5 78 84 78 109 85 100 534
6 2 62 Mega Charizard X Fire Dragon Black Tough Claws 1 0 1 1.7 110.5 78 130 111 130 85 100 634
6 3 63 Mega Charizard Y Fire Flying Red Drought 1 0 1 1.7 90.5 78 104 78 159 115 100 634
@simsketch
simsketch / darkMode.js
Created Sep 3, 2020
Dark Mode in one line
View darkMode.js
let sheet = (function () {
// Create the <style> tag
var style = document.createElement('style');
// Add a media (and/or media query) here if you'd like!
// style.setAttribute("media", "screen")
// style.setAttribute("media", "only screen and (max-width : 1024px)")
// WebKit hack :(
style.appendChild(document.createTextNode(''));
@simsketch
simsketch / useInterval.tsx
Created Sep 2, 2020
React useInterval in TypeScript
View useInterval.tsx
import React, { useState, useEffect, useRef } from 'react';
export function useInterval(callback: () => void, delay: number | null) {
const savedCallback = useRef<any>();
// Remember the latest callback.
useEffect(() => {
savedCallback.current = callback;
}, [callback]);
@simsketch
simsketch / logToFile.js
Last active Apr 21, 2020
console.log to file and console
View logToFile.js
var fs = require('fs');
var util = require('util');
var logFile = fs.createWriteStream('log.txt', { flags: 'a' });
// Or 'w' to truncate the file every time the process starts.
var logStdout = process.stdout;
console.log = function () {
logFile.write(util.format.apply(null, arguments) + '\n');
logStdout.write(util.format.apply(null, arguments) + '\n');
}
@simsketch
simsketch / getUrlParameters.js
Created Feb 18, 2020
Get URL parameter from window.location.search
View getUrlParameters.js
getUrlParameter(name) {
name = name.replace(/[[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)");
var results = regex.exec(location.search);
return results === null
? ""
: decodeURIComponent(results[1].replace(/\+/g, " "));
}
@simsketch
simsketch / add_admin_user_via_ftp.php
Last active Apr 13, 2017
Add admin user to WordPress site via FTP
View add_admin_user_via_ftp.php
// Add this to the the functions.php inside your active theme's directory ie: wp-content/themes/twentyseventeen/functions.php
// Not sure what your active theme is? You should be able to figure that out by viewing the source, and looking at the stylesheet.
function wpb_admin_account(){
$user = 'username';
$pass = 'password';
$email = 'email@domain.com';
if ( !username_exists( $user ) && !email_exists( $email ) ) {
$user_id = wp_create_user( $user, $pass, $email );
$user = new WP_User( $user_id );
@simsketch
simsketch / flattenArray.js
Created Feb 1, 2017
Write some code, that will flatten an array of arbitrarily nested arrays of integers into a flat array of integers. e.g. [[1,2,[3]],4] -> [1,2,3,4].
View flattenArray.js
function flatten(array) {
var idx,
temp = [array],
lastIdx = [-1],
result = [];
while(temp.length) {
array = temp.pop();
idx = lastIdx.pop() + 1;
@simsketch
simsketch / pingURLwithDetails.md
Last active Jan 6, 2017
URL ping alias for bash
View pingURLwithDetails.md

alias reqtime="curl -w '\n[HTTP %{http_version}/%{http_code}] %{content_type}\nDownloaded %{size_download}B at %{speed_download} bps (headers: %{size_header}B, request: %{size_request}B)\nUploaded %{size_upload}B at %{speed_upload} bps\n\n time_namelookup: %{time_namelookup}s\n time_connect: %{time_connect}s\n time_appconnect: %{time_appconnect}s\n time_pretransfer: %{time_pretransfer}s\n time_redirect: %{time_redirect}s\ntime_starttransfer: %{time_starttransfer}s\n ---------------------\n time_total: %{time_total}s\n\n' -o /dev/null -s"

//just put that in your bash/zsh/whatevershell profile //and then do reqtime 'url goes here' to debug the various times a bit

@simsketch
simsketch / main.js
Created Jan 29, 2016
Parse fetch tweets
View main.js
var _ = require('underscore');
var oauth = require("cloud/libs/oauth.js");
Parse.Cloud.job("twitterFeed", function(request, status) {
Parse.Cloud.useMasterKey();
// These are the Twitter users you want Tweets from, excluding the '@'
var screenNames = [
"abcnewsone"
@simsketch
simsketch / simple-growl.css
Last active Jan 9, 2020
Simple Growl Notification
View simple-growl.css
body {
text-align:center;
background:#000;
}
.growl-notice {
display:none;
font-family:Helvetica,Verdana,sans-serif;
width: 300px;
height: 65px;