Skip to content

Instantly share code, notes, and snippets.

Christian Genco christiangenco

Block or report user

Report or block christiangenco

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@stolinski
stolinski / mockMang.js
Created Apr 9, 2018
Level Up Tutorials MockMang
View mockMang.js
import { makeExecutableSchema, addMockFunctionsToSchema } from 'graphql-tools';
import { graphql } from 'graphql';
import GraphQLMock from 'graphql-mock';
import typeDefs from 'imports/startup/both/typeDefs';
// Make a GraphQL schema with no resolvers
const schema = makeExecutableSchema({ typeDefs });
// Creates random id
const revisedRandId = () =>
@alekseykulikov
alekseykulikov / index.md
Last active Feb 20, 2019
SUIT CSS naming convention for React.js application
View index.md

Recently CSS has got a lot of negativity. But I would like to defend it and show, that with good naming convention CSS works pretty well.

My 3 developers team has just developed React.js application with 7668 lines of CSS (and just 2 !important). During one year of development we had 0 issues with CSS. No refactoring typos, no style leaks, no performance problems, possibly, it is the most stable part of our application.

Here are main principles we use to write CSS for modern (IE11+) browsers:

View gist:122907e95956602e5c09
<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@colinstein
colinstein / keychaincli.md
Last active Apr 29, 2019
Storing CLI password in Keychain on Mac OS X
View keychaincli.md

Secure CLI Passwords with Keychain Services on Mac OS X

Creating a Password

Dump a password into keychain. I'm using the creator/kind codes "asbl" for Ansible, but you can use any 4 character code. It's useful for doing lookups later.

$ security add-generic-password -a "root" -c "asbl" -C "asbl" -D "Ansible Vault" -s "ansible secrets" -w "secret123password456"

From man security:

@ldong
ldong / download_egghead_videos.md
Last active May 6, 2019
download egghead videos
View download_egghead_videos.md

Download videos from egghead

Go to the egghead website, i.e. Building a React.js App

run

$.each($('h4 a'), function(index, video){
  console.log(video.href);
});
@nagachika
nagachika / .gitignore
Created May 29, 2015
picasa with OAuth 2.0
View .gitignore
/.bundle
/vendor/bundle
/.envrc
@anton-rudeshko
anton-rudeshko / convert.sh
Last active Apr 6, 2019
Convert GoPro photos to timelapse video using ffmpeg CLI.
View convert.sh
#!/usr/bin/env bash
# -r 60: 60 FPS
# -y: rewrite output file
# -start_number 11555: first frame number
# -i 'G%07d.JPG': file format
# -vf "crop=h=2250": video filter to crop input frame height from 3000 to 2250 (which will be eventually downscaled to 720)
# -c:v libx264: video codec x264
# -crf 20: x264 encoding quality (less = better)
# -s 1280x720: output size
@jareware
jareware / s3-curl-backups.md
Last active Feb 21, 2019
Simple, semi-anonymous backups with S3 and curl
View s3-curl-backups.md

⇐ back to the gist-blog at jrw.fi

Simple, semi-anonymous backups with S3 and curl

Backing stuff up is a bit of a hassle, to set up and to maintain. While full-blown backup suites such as duplicity or CrashPlan will do all kinds of clever things for you (and I'd recommend either for more complex setups), sometimes you just want to put that daily database dump somewhere off-site and be done with it. This is what I've done, with an Amazon S3 bucket and curl. Hold onto your hats, there's some Bucket Policy acrobatics ahead.

There's also a tl;dr at the very end if you just want the delicious copy-pasta.

Bucket setup

View slurper.rb
require 'rubygems'
require 'httparty'
require 'fileutils'
require 'json'
USERNAME = ARGV[0] || "patio11"
MAX_TO_FETCH = ARGV[1]
puts "Username: #{USERNAME} max to fetch: #{MAX_TO_FETCH || "all"}"
View gist:b0c00a889dc2a17efad9
var randomNumbers = [42, 12, 88, 62, 63, 56, 1, 77, 88, 97, 97, 20, 45, 91, 62, 2, 15, 31, 59, 5]
func partition(v: Int[], left: Int, right: Int) -> Int {
var i = left
for j in (left + 1)..(right + 1) {
if v[j] < v[left] {
i += 1
(v[i], v[j]) = (v[j], v[i])
}
}
You can’t perform that action at this time.