Skip to content

Instantly share code, notes, and snippets.

View pawndev's full-sized avatar
:octocat:
Trying to quit vim

Coquelet Christophe pawndev

:octocat:
Trying to quit vim
View GitHub Profile
@mathieutu
mathieutu / index.d.ts
Last active January 22, 2023 01:12
PackageJson Typescript definitions.
export interface PackageJSON extends Object {
name: string
version?: string
description?: string
keywords?: string[]
homepage?: string
bugs?: string | Bugs
license?: string
author?: string | Author
contributors?: string[] | Author[]
const array = [1, 2, 3, 5, 1, 5, 9, 1, 2, 8];
Array.from(new Set(array));
@LeReverandNox
LeReverandNox / quick-look.sh
Created July 21, 2018 15:41
Poor's man quicklook
#!/bin/bash
function quick-look() {
SCREEN_WIDTH=$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f1)
SCREEN_HEIGHT=$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f2)
WIDTH=$(echo $(( ${SCREEN_WIDTH} * 0.75)) | cut -f1 -d".")
HEIGHT=$(echo $(( ${SCREEN_HEIGHT} * 0.75)) | cut -f1 -d".")
feh --title="feh_quicklook" --scale-down --geometry "${WIDTH}"x"${HEIGHT}" $1 $(pwd) >/dev/null 2>&1
}
@brien-crean
brien-crean / react_interaction_observer_api.js
Created November 27, 2017 07:47
React component with Intersection Observer API
// simple react component to demonstrate intersection observer API usage
// renders box in red when fully visible otherwise renders in blue
import React, { Component } from 'react';
class Box extends Component {
constructor(props) {
super(props)
this.state = {
@nemoDreamer
nemoDreamer / styles.less
Created May 20, 2017 12:16
Subtle italics in Atom syntaxes
atom-text-editor.editor {
.syntax--punctuation.syntax--whitespace.syntax--comment.syntax--leading,
.syntax--source {
font-family: FiraCode-Retina; // https://github.com/tonsky/FiraCode
text-rendering: optimizeLegibility;
letter-spacing: 0;
}
.syntax--string.quoted,
.syntax--string.regexp {
function instantiate(element) {
const { type, props } = element;
// Create DOM element
const isTextElement = type === "TEXT ELEMENT";
const dom = isTextElement
? document.createTextNode("")
: document.createElement(type);
updateDomProperties(dom, [], props);
{
"name": "react-redux-boilerplate",
"version": "0.0.1",
"description": "",
"main": "js/app.js",
"dependencies": {
"react": "0.14.6",
"react-dom": "0.14.6",
"react-redux": "^4.4.1",
"redux": "^3.3.1",
@isimmons
isimmons / gist:8202227
Last active July 26, 2024 16:15
Truncate tables with foreign key constraints in a Laravel seed file.

For the scenario, imagine posts has a foreign key user_id referencing users.id

public function up()
{
	Schema::create('posts', function(Blueprint $table) {
		$table->increments('id');
		$table->string('title');
		$table->text('body');
@miohtama
miohtama / parse-hash-bang-arguments-in-javascript.js
Created January 6, 2012 12:08
Parse hash bang HTTP GET query style arguments from an URL using Javascript
/**
* Parse hash bang parameters from a URL as key value object.
*
* For repeated parameters the last parameter is effective.
*
* If = syntax is not used the value is set to null.
*
* #x&y=3 -> { x:null, y:3 }
*
* @param aURL URL to parse or null if window.location is used