Skip to content

Instantly share code, notes, and snippets.

View willnode's full-sized avatar

Wildan M willnode

View GitHub Profile
@erikstorm
erikstorm / ffmpeg-compress-mp4
Last active March 9, 2018 06:07 — forked from lukehedger/ffmpeg-compress-mp4
Compress mp4 using FFMPEG
$ ffmpeg -i input.mp4 -vcodec h264 -b:v 800k -acodec mp3 output.mp4
@lanedraex
lanedraex / listener.rs
Created November 5, 2017 09:12
Rust UDP socket: send and receive
use std::net;
use std::env;
fn listen(socket: &net::UdpSocket, mut buffer: &mut [u8]) -> usize {
let (number_of_bytes, src_addr) = socket.recv_from(&mut buffer).expect("no data received");
println!("{:?}", number_of_bytes);
println!("{:?}", src_addr);
@eddyLazar
eddyLazar / ReactBootstrapTable.jsx
Last active March 1, 2020 04:20
example of implementing wenzhixin bootstrap-table with react
import React from 'react'
import ReactDOM from 'react-dom'
const BootstrapTable = React.createClass({
componentDidMount() {
$(ReactDOM.findDOMNode(this)).bootstrapTable(this.props)
},
componentWillReceiveProps(nextProps) {
$(ReactDOM.findDOMNode(this)).bootstrapTable('refreshOptions', nextProps)
},
@sindresorhus
sindresorhus / x.js
Created May 6, 2017 19:07
Copy + paste + devtools
[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]](([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+
@AlexWebLab
AlexWebLab / style.css
Last active September 12, 2023 17:05
Retina displays CSS background image
.logo_background {
background-image: url('../img/logo@1x.png');
background-position: center center;
background-repeat: no-repeat;
background-size: 80px 40px; /* size of the logo image @ 1x */
}
@media /* only for retina displays */
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (min--moz-device-pixel-ratio: 2),
only screen and (min-device-pixel-ratio: 2),
@hydrix9
hydrix9 / Server.cs
Created January 19, 2017 23:46
c# websocket server for unity3d game test
#if (!UNITY_WEBGL || DEBUG) //run from compiler and unity_editor but not webgl release
using System;
using WebSocketSharp;
using WebSocketSharp.Server;
using System.Collections.Generic; //lists
using System.Linq; //dictionary keys toarray
using System.Collections; //enumerator
@Seneral
Seneral / GUIScaleUtility.cs
Last active May 5, 2023 05:46
Advanced GUI scaling for Unity. Fixes problems with unscaled clipping rect using reflection. Allows for custom zoom positions other than (0,0). Need all elements to offset by a specified value to account for zoom position and scale though. Example of use is my open source Node Editor Framework
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using System.Reflection;
namespace NodeEditorFramework.Utilities
{
public static class GUIScaleUtility
@radiatoryang
radiatoryang / SkinnedMeshObjectPreviewExample.cs
Last active October 7, 2022 10:07
An example of a custom ObjectPreview rendering out a SkinnedMesh for Unity Editor C#... I used it for facial expressions and blendshape editing, you might want to use it for something else. I hereby place it under MIT License. Full write-up here: http://www.blog.radiator.debacle.us/2016/06/working-with-custom-objectpreviews-and.html
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
[CustomPreview(typeof(YourCustomScriptableObject))] // THIS IS VERY IMPORTANT, this is so the editor knows what this is supposed to be previewing at all
public class SkinnedMeshObjectPreviewExample : ObjectPreview {
PreviewRenderUtility m_PreviewUtility;

How you can help reduce node_modules bloat

This recent reddit thread reveals discontent among the web development community about the sheer volume of stuff in a typical node_modules dir. 140MB in this case!

Is it a design flaw in npm?

Opinions in the thread varied from "I'm surprised npm even works" to "everything is fine". I'm not going to offer an opinion, just these two observations:

  1. node_modules dirs typically do contain lots of stuff that doesn't need to be there.
  2. The latest version mitigates overall size by flattening the dependency tree, but some of the bloat is beyond npm's control.
@nirleka
nirleka / AutoSave.cs
Created January 9, 2016 08:41
Unity 5 AutoSave on Run & on 1-10 minutes interval
using UnityEngine;
using UnityEditor;
using System;
using UnityEditor.SceneManagement;
using UnityEngine.SceneManagement;
namespace NirSoft.UtilityEditor
{
/// <summary>
/// Autosave scene on run.