Skip to content

Instantly share code, notes, and snippets.

View sunny's full-sized avatar
☀️

Sunny Ripert sunny

☀️
View GitHub Profile
# Calcul du nombre de jours par niveau de fréquentation pour Brouillon Coffee.
#
# Pour lancer le script, il faut installer la librairie `jours_feries_france`.
# Dans un terminal, exécuter la commande suivante:
# $ gem install jours_feries_france
#
# Puis, exécuter le script avec la commande suivante pour générer un fichier
# CSV nommé `days.csv`:
# $ ruby brouillon-days.rb > days.csv
@sunny
sunny / us_zip_codes.csv
Created July 18, 2023 09:05
US zip codes to state
code state
00501 NY
00544 NY
01001 MA
01002 MA
01003 MA
01004 MA
01005 MA
01007 MA
01008 MA
class Die
def initialize(count = 1, faces = 1)
@count = count
@faces = faces
end
attr_reader :count, :faces
def rolls
return [count] if faces == 1
class Sudoku
def initialize(lines)
@lines = lines
end
attr_reader :lines
def complete?
groups.all? { |group| complete_group?(group) }
end
outbrain.com, 00512545eb151d5d126f2d066b27600362, DIRECT
tremorhub.com, q017o-78mlk, RESELLER, 1a4e959a1b50034a
teads.tv, 15429, RESELLER, 15a9c44f6d26cbe1
advertising.com, 26154, RESELLER
spotxchange.com, 225721, RESELLER
rubiconproject.com, 17130, RESELLER, 0bfd66d529a55807
lkqd.net, 450, RESELLER, 59c49fa9598a0117
openx.com, 540393169, RESELLER, 6a698e2ec38604c6
spotx.tv, 238936, RESELLER, 7842df1d2fe2db34
spotxchange.com, 238936, RESELLER, 7842df1d2fe2db34
@sunny
sunny / Add a discount.graphql
Last active August 29, 2024 15:00
Cults query examples
mutation {
createDiscount(
creationId: "Q3JlYXRpb24vMjIwMjQzMA"
discountPercentage: 50
discountEndAt: "2024-09-01T16:59:12+02:00"
) {
discount {
creation {
name
price {
@sunny
sunny / cults_graphql.rb
Created March 27, 2023 20:34
Example Ruby GraphQL call for Cults
# Example GraphQL call using https://github.com/github/graphql-client
require 'graphql/client'
require 'graphql/client/http'
require 'base64'
query_string = <<~QUERY
{
creationsBatch(limit: 3) {
results {
<?php
$query = <<<'JSON'
{
creationsBatch(limit: 3) {
results {
name(locale: EN)
url
creator {
nick
# Example GraphQL call using https://github.com/prisma/python-graphql-client
from sgqlc.endpoint.http import HTTPEndpoint
import base64
query = '''
{
creationsBatch(limit: 3) {
results {
name(locale: EN)
@sunny
sunny / add_frozen_string_literal_comment.rb
Last active November 23, 2022 17:03 — forked from ta1kt0me/add_frozen_string_literal_comment.rb
Add frozen string literal comment into generated files in Rails 7
# frozen_string_literal: true
# Via https://gist.github.com/ta1kt0me/6a7058d16621785d4f7038bde6cd3b98
module RailsGeneratorFrozenStringLiteralPrepend
RUBY_EXTENSIONS = %w[.rb .rake].freeze
def render
return super unless RUBY_EXTENSIONS.include?(File.extname(destination))
"# frozen_string_literal: true\n\n#{super}"