Skip to content

Instantly share code, notes, and snippets.

View natzar's full-sized avatar
🎯
Focusing

Beto natzar

🎯
Focusing
View GitHub Profile
@estevecastells
estevecastells / gist:0f22de07936f99494a40c75ad1cb6afa
Last active October 28, 2023 13:21
Custom Prompt ChatGPT
- Be highly organized.
- Suggest proactive solutions and anticipate my needs.
- Treat me as an expert in all subject matter.
- Be accurate and thorough; mistakes erode my trust.
- Provide detailed explanations; I appreciate lots of detail.
- Value good arguments over authorities; the source is irrelevant.
- Consider new technologies and contrarian ideas.
- High levels of speculation or prediction are fine; just flag it.
- Recommend only the highest-quality, meticulously designed products.
- Recommend products from all over the world; location is irrelevant.
@levelsio
levelsio / Is it now Ramadan.php
Last active June 6, 2018 01:58
"Is it now Ramadan?" function in PHP
# by @levelsio
#
# MIT licensed
#
# make sure you enable php_intl on PHP
# you can do by uncommenting ;extension=intl or ;extension=php_intl
# and installing php-intl, e.g. sudo apt-get install php-intl
#
# made for Nomad List to give people a notice if they go to a place
# where it is currently Ramadan
@jangnezda
jangnezda / main.js
Created October 12, 2016 11:44
How to load an external URL in <iframe> using Electron
/*
* By default, Electron (well, underlying Chrome browser) will reject loading external URLs
* to an <iframe>. To circumvent this limitation, we can manipulate response headers from any
* http request and feed them to the Electron window.
*
* The 'onHeadersReceived' listener is documented here:
* http://electron.atom.io/docs/api/session/#webrequestonheadersreceivedfilter-listener
*/
app.on('ready', () => {
@ozzieliu
ozzieliu / calling_stubhub_api.py
Last active September 9, 2023 16:56
Proof of Concept task to get ticket prices and event info using StubHub's API with Python
# Quick intro to accessing Stubhub API with Python
# Ozzie Liu (ozzie@ozzieliu.com)
# Related blog post: http://ozzieliu.com/2016/06/21/scraping-ticket-data-with-stubhub-api/
# Updated 3/5/2017 for Python 3 and Stubhub's InventorySearchAPI - v2
import requests
import base64
import json
import pprint
import pandas as pd
@gokulkrishh
gokulkrishh / media-query.css
Last active May 4, 2024 16:17
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
@markhowellsmead
markhowellsmead / .htaccess
Last active March 19, 2024 20:25
Detect browser language and redirect to appropriate language version of the website
# Redirect visitors who request the root domain path (e.g. www.mywebsite.ch) to the appropriate language version
# Fallback to English version if no matching browser language defined
# Based on language version being at e.g. www.mywebsite.ch/de/
# This has no effect on any subpaths of the website, and therefore has no effect on e.g. WordPress admin.
# Using a 302 temporary redirect header stops the redirection from being cached in the browser.
# language is ES-MX (Mexico)
RewriteCond %{HTTP:Accept-Language} ^es-mx [NC]
RewriteRule ^$ /mx/ [L,R=302]
These weights are often combined into a tf-idf value, simply by multiplying them together. The best scoring words under tf-idf are uncommon ones which are repeated many times in the text, which lead early web search engines to be vulnerable to pages being stuffed with repeated terms to trick the search engines into ranking them highly for those keywords. For that reason, more complex weighting schemes are generally used, but tf-idf is still a good first step, especially for systems where no one is trying to game the system.
There are a lot of variations on the basic tf-idf idea, but a straightforward implementation might look like:
<?php
$tfidf = $term_frequency * // tf
log( $total_document_count / $documents_with_term, 2); // idf
?>
It's worth repeating that the IDF is the total document count over the count of the ones containing the term. So, if there were 50 documents in the collection, and two of them contained the term in question, the IDF would be 50/2 = 25. To be accurate, we s
@xdamman
xdamman / Accept all friends requests.js
Created December 21, 2012 07:13
Facebook friend requests zero I had 236 pending friends requests, so I decided to accept them all as a gesture before the end of the world. I wasn't ready to click on them all so just made that quick script you can run in the console when you are on the page https://www.facebook.com/friends/requests/
var a = document.getElementsByTagName('input');
for(var i=0;i<a.length;i++) if(a[i].getAttribute('value')=='Confirm') a[i].click();
@nhoizey
nhoizey / screenshots.js
Created November 12, 2012 17:07
Take screenshots at different viewport sizes using CasperJS
/*
* Takes provided URL passed as argument and make screenshots of this page with several viewport sizes.
* These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed
*
* Usage:
* $ casperjs screenshots.js http://example.com
*/
var casper = require("casper").create();