This file contains hidden or 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
| { | |
| "always_run_in_app" : false, | |
| "icon" : { | |
| "color" : "yellow", | |
| "glyph" : "fire" | |
| }, | |
| "name" : "WIP Streak", | |
| "script" : "\/\/ Replace with your API key\nconst API_KEY = \"wip_sk_REPLACE_ME\";\nconst API_URL = `https:\/\/api.wip.co\/v1\/users\/me.json?api_key=${API_KEY}`;\n\n\/\/ Function to fetch data from the API\nasync function fetchStreakData() {\n let request = new Request(API_URL);\n let response = await request.loadJSON();\n return response;\n}\n\n\/\/ Function to calculate hours left until midnight in a given time zone\nfunction hoursLeftUntilMidnight(timeZone) {\n let now = new Date();\n let nowInUserTimeZone = new Date(now.toLocaleString(\"en-US\", { timeZone: timeZone }));\n let midnight = new Date(nowInUserTimeZone);\n midnight.setHours(24, 0, 0, 0); \/\/ Set to midnight\n\n let hoursLeft = (midnight - nowInUserTimeZone) \/ (1000 * 60 * 60); \/\/ Convert milliseconds to hours\n return hoursLeft.toFixed(0);\n}\n\n\/\/ Function to create a widget displaying the streak info\nasy |
This file contains hidden or 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
| <?php | |
| // Get your API key here: https://wip.co/my/api_keys | |
| $apiKey = 'wip_sk_FOOBAR'; | |
| $baseUrl = 'https://api.wip.co/v1'; | |
| $projectSlug = 'nomadlist'; | |
| // Get todos for the project with pagination | |
| $limit = 10; | |
| $startingAfter = isset($_GET['starting_after']) ? $_GET['starting_after'] : null; |
This file contains hidden or 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
| require "sidekiq/api" | |
| # Fetch scheduled Sidekiq jobs for migration to GoodJob | |
| def fetch_sidekiq_jobs_for_goodjob_migration | |
| raise "Remove this line if you understand this code is not properly tested and you assume the risk of losing data" | |
| puts "Starting to fetch scheduled Sidekiq jobs for migration..." | |
| scheduled_set = Sidekiq::ScheduledSet.new | |
| jobs = scheduled_set.map do |job| | |
| { |
This file contains hidden or 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
| module GoodJobThrottleExtension | |
| extend ActiveSupport::Concern | |
| GoodJobThrottleExceededError = Class.new(GoodJob::ActiveJobExtensions::Concurrency::ConcurrencyExceededError) | |
| included do | |
| include GoodJob::ActiveJobExtensions::Concurrency | |
| class_attribute :throttle_enabled, default: false | |
| class_attribute :throttle_count, default: 2 |
This file contains hidden or 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
| <?php | |
| $username = isset($_GET['username']) ? $_GET['username'] : 'marcano'; | |
| function graphql_query($endpoint, $query, $variables = [], $token = null) { | |
| $headers = ['Content-Type: application/json', 'User-Agent: Minimal GraphQL client']; | |
| if (null !== $token) { | |
| $headers[] = "Authorization: bearer $token"; | |
| } |
This file contains hidden or 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
| # NOTE: Don't get your two Redis URLs mixed up or you'll lose data! | |
| require "redis" | |
| redis1 = Redis.new(url: ENV.fetch("REDIS_ORIGIN_URL")) | |
| redis2 = Redis.new(url: ENV.fetch("REDIS_DESTINATION_URL")) | |
| # NOTE: Uncomment this if you want to clear out all Sidekiq stats from the ORIGIN(!) server | |
| # redis1.pipelined do |pipeline| | |
| # redis1.keys("stat:processed:*").each do |key| |
This file contains hidden or 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
| # Make sure you have a .env file with DISCORD_CLIENT_ID set | |
| require "dotenv/load" | |
| require "http" | |
| puts "Go to the following URL in your browser to authorize this application:" | |
| puts "https://discord.com/api/oauth2/authorize?response_type=token&client_id=#{ENV.fetch("DISCORD_CLIENT_ID")}&scope=identify%20email%20connections%20guilds%20guilds.join%20guilds.members.read%20messages.read" | |
| puts "" | |
| puts "Paste the URL you were redirected to after authorization:" |
This file contains hidden or 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
| javascript:(function()%7Bwindow.location%20%3D%20%60https%3A%2F%2Ftwitter.com%2Fsearch%3Fq%3Dfrom%253A%24%7Bdocument.location.href.match(%2Ftwitter.com%5C%2F(%5Ba-z0-9_%5D%2B)%2Fi)%5B1%5D%7D%2520min_retweets%253A25%26src%3Dtyped_query%60%7D)() // window.location = `https://twitter.com/search?q=from%3A${document.location.href.match(/twitter.com\/([a-z0-9_]+)/i)[1]}%20min_retweets%3A25&src=typed_query` |
This file contains hidden or 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
| body { background-color: rgb(246, 246, 239); margin-top: 0 } | |
| .title { font-size: 16px; padding-top: .6em; padding-bottom: .3em; } | |
| .athing > .votelinks { padding-top: .8em } | |
| .subtext { font-size: 12px; } | |
| .comment { font-size: 16px; line-height: 1.5; } |
This file contains hidden or 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
| # Calculates estimated time it takes for a block to return zero. Useful when | |
| # running operations in parallel (e.g. migrations). | |
| # | |
| # Usage: | |
| # Run in IRB/Rake/whatever: add_slugs_to_each_post # example of long-running operations | |
| # Run in parallel IRB session: countdown { Post.where(slug: nil).count } | |
| # | |
| # sleep_time parameter is optional. The higher the value the more accurate the | |
| # results, but the longer the method takes to run. |